I am receiving email arrival Date like "Tue,14 Jul 2020 03: 15: 03 +0000 (UTC)", this needs to converted into this format "2020-02-11 16:05:00". Can anyone please help me to achieve this Date conversion?
Partially formed Input Date format like : EEE, d MMM yyyy HH:mm:ss
Can anyone give me exact date format for my input Date?
What i have tried:
try
{
String date_s = "Tue,14 Jul 2020 03: 15: 03 +0000 (UTC)";
SimpleDateFormat simpledateformat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss");
Date tempDate=simpledateformat.parse(date_s);
SimpleDateFormat outputDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("Output date is = "+outputDateFormat.format(tempDate));
} catch (Exception ex)
{
ex.printStackTrace();
}
Exception like below:
java.text.ParseException: Unparseable date: "Tue,14 Jul 2020 03: 15: 03 +0000 (UTC)"
at java.text.DateFormat.parse(DateFormat.java:366)
at JavaPackage.DateConvertion.main(DateConvertion.java:12)
Awaiting for your response.
Note: Just for Date Format Identification purpose , randomly given above converted Date.