Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
SupItzAdeem
Contributor
Contributor

Cannot Parse String to Date

Hey guys, I'm quite new to Talend and started learning it recently for school. My assignment requires me to take a csv file and parse the date from this format "July 1 2024" into a date format so I can check for some rejected entries. I have used a tmap with the ParseDate expression but it keeps giving me this error:

Exception in component tMap_1 (DonationDataProcessing)
java.lang.RuntimeException: java.text.ParseException: Unparseable date: "July 1 2024"
at routines.TalendDate.parseDate(TalendDate.java:971)
at routines.TalendDate.parseDate(TalendDate.java:915)
at demo_project.donationdataprocessing_0_1.DonationDataProcessing.tFileList_1Process(DonationDataProcessing.java:1869)
at demo_project.donationdataprocessing_0_1.DonationDataProcessing.runJobInTOS(DonationDataProcessing.java:2577)
at demo_project.donationdataprocessing_0_1.DonationDataProcessing.main(DonationDataProcessing.java:2415)
Caused by: java.text.ParseException: Unparseable date: "July 1 2024"
at java.base/java.text.DateFormat.parse(DateFormat.java:395)
at routines.TalendDate.parseDate(TalendDate.java:957)
... 4 more

Here is my tmap attached as well

SupItzAdeem_0-1722621783517.png

Any help would be very much appreciated. Thanks

Labels (3)
1 Reply
Shicong_Hong
Support
Support

Hello

You should use the right date pattern to parse the date string, use the below expression for the date string format like this "July 1 2024",

TalendDate.parseDate("MMM dd yyyy",row1.Date)

Regards

Shicong