Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static void main(String[] args) {

        String str = "Thu Jun 06 2013 00:00:00 GMT+0530";
        DateFormat outputDate = new SimpleDateFormat("EEE MMM dd yyyy hh:mm:ss");
        try {
            Date date = outputDate.parse(str);
            String date1 = new SimpleDateFormat("dd-mm-yyyy, hh:mm:ss").format(date);
            System.out.println(date1.toString());
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}