How to parse String to Date with Talend in this format "Tue Feb 23 00:00:00 EST 2021"

Viewed 626

im trying to parse my String to Date but i got this error :

Unparseable date: "Tue Feb 23 00:00:00 EST 2021"

This is what i do :

enter image description here

The code in the expression builder is:

TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy",row1.DAT_DEB_ACTIF)

How can I fix this problem?

Thank you!

2 Answers

I guess that your studio is installed on a machine with a non-english OS.

Try to force the locale to "english" with

TalendDate.parseDateLocale("EEE MMM dd HH:mm:ss Z yyyy",  row1.DAT_DEB_ACTIF, "en")

This is my solution :

TalendDate.parseDate("yyyy-MM-dd",new SimpleDateFormat("yyyy-MM-dd").format(new Date(row1.DAT_DEB_ACTIF))) 
Related