How do I convert Fri Mar 16 00:00:00 EDT 2007 into the format "yyyyMMdd" ? I'm using Talend but I can figure it out if I'm given Java code

StackOverflow https://stackoverflow.com/questions/22701955

  •  23-06-2023
  •  | 
  •  

Question

I'm given the date format: Fri Mar 16 00:00:00 EDT 2007

I thought the format was as follows: ddd MMM dd HH:mm:ss 'ICT' yyyy, but no such luck.

In case anyone has used Talend, this is the code I tried:

!(Loan.OriginationDate == null) ?
TalendDate.isDate("Fri Mar 16 00:00:00 EDT 2007", "ddd MMM dd HH:mm:ss 'ICT' yyyy") ? "Correct Format" 

:":("
:null

Basically the code tests to see if the date is in the format ddd MMM dd HH:mm:ss 'ICT' yyyy

Was it helpful?

Solution

After many hours of trail and error, I finally found it. The format is:

EEE MMM dd HH:mm:ss z yyyy

OTHER TIPS

You can use SimpleDateFormat class of java.txt package

Have a look on related documentation here SimpleDateFormat

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top