Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I was get in file as below format
02/11/2019 07:06:47 AM
and I use below logic to load into table
TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",TalendDate.parseDate("MM/dd/yyyy hh:mm:ss a",row5.Date))
But Now I am getting in file as below format . How can i make sure to handle both formats
10/1/2018 7:06
try to change while creating meta data using the file and see s below
Is other way to fix than metadata
Try to read column as string and validate it after in tMap against with all possible date format.
below link will help
https://community.talend.com/t5/Design-and-Development/how-to-parse-various-date-formats/td-p/140825
Hi,
If you are looking for a quick a dirty way, check the number of colons in the input string. It can be ether 2 or 3 based on your input flow.
If its 3, use the existing method to parse it. In the else condition, use the new parse logic. But I would like to again stress that its a quick way to solve the problem. If you are going to have lot of different formats, it might be a problem.
Ideally it is a source issue and they should send the data in agreed format. They cannot send the data in whatever format they want in a proper enterprise environment.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂