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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Bhagwati1
Contributor II
Contributor II

[resolved] Different date formats in Excel Source

Hello Guys,
I am loading data from multiple excels into a database table.
The date format in excels is not consistent.
in some of the excels the date format is dd/MM/yyyy and below format works.
TalendDate.parseDate("yyyy-MM-dd",
TalendDate.formatDate("yyyy-MM-dd",
TalendDate.parseDate("dd/MM/yyyy",row2.Rec_Dt))) 
but there are some excels in which date format is dd/MM/yy and wrong date is inserted into the destination table.below is the example.
23/12/15 is inserted as 0015-12-23

Could you please help?
Thanks Bhagwati
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi 
Read the column as a string, populate the length of the string and then parse the string to a date using different expression based on the length, eg:
tFileinputExcel--main--tMap--out1....
on tMap:
row1.columnName.length==10?TalendDate.parseDate("dd/MM/yyyy",row1.columnName):TalendDate.parseDate("dd/MM/yy",row1.columnName)
Regards
Shong

View solution in original post

3 Replies
Anonymous
Not applicable

Hi 
Read the column as a string, populate the length of the string and then parse the string to a date using different expression based on the length, eg:
tFileinputExcel--main--tMap--out1....
on tMap:
row1.columnName.length==10?TalendDate.parseDate("dd/MM/yyyy",row1.columnName):TalendDate.parseDate("dd/MM/yy",row1.columnName)
Regards
Shong
Bhagwati1
Contributor II
Contributor II
Author

Thanks Shong!!!!
Anonymous
Not applicable

Hii,

i've tried the exact same job .but it didn't work.its giving me Error as length cannot be resolved or it is not field.please help me out.


Date_task.PNG