Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Karuetl
Creator II
Creator II

Date format in file

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

Labels (2)
4 Replies
Anonymous
Not applicable

try to change while creating meta data using the file and see s below

 

0683p000009M2e1.png

Karuetl
Creator II
Creator II
Author

Is other way to fix than metadata

akumar2301
Specialist II
Specialist II

 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

Anonymous
Not applicable

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 🙂