首页javalegacy_date_formatJava Data Type - 如何simpleDateFormat格式:Thu Jun 06 2013 00:00:00 GMT + 0530

Java Data Type - 如何simpleDateFormat格式:Thu Jun 06 2013 00:00:00 GMT + 0530

我们想知道如何simpleDateFormat格式:Thu Jun 06 2013 00:00:00 GMT + 0530。
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();
        }
    }
}