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: 
Anonymous
Not applicable

unable to convert Numeric field to a date.

Hi I am trying to convert an integer to a date format using tMap but I keep getting errors.
I am importing a csv file and one of the fields is a date field stored as a number. The first 4 numbers is the year the next 2 numbers the month and the last 2 numbers the day.
E.g. 20130607 would be June 7th of year 2013. I want to convert the number to a date format as follows 07/06/2013.
At moment I can't even cast to a date format. I tried TalendDate.formatDate("yyyyMMdd",myDate) but I get the error 'myDate cannot be resolved to a variable'?
Labels (3)
3 Replies
Anonymous
Not applicable
Author

Hi,
For your case, what's the input source? I think it should be row1.myDate? In addition, the method formatDate(String, Date). I think you should TalendDate.parseDate(String pattern, String stringDate) method into consideration.
Best regards
Sabrina
0683p000009MEgv.png
Anonymous
Not applicable
Author

Great thank you. I was trying to cast an int to a Date in the destination table, but I can see in your example you set the Date format in the source data. Many thanks.
Anonymous
Not applicable
Author

Hi,
If you want to convert Int to Date, please refer to this forum https://community.talend.com/t5/Design-and-Development/Int-to-Date/td-p/62918
Best regards
Sabrina