One Star

Int to Date

Hi,
I've a Excel file with date in format (25791, 25394 ...) (so int for Talend) and i want to convert it into format (11/08/1970, 10/07/1969, ...) (so date for Talend).
Can you help me please ?
6 REPLIES
Community Manager

Re: Int to Date

Hello
Convert long type to Date type on tMap
new java.util.Date(long number)
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Int to Date

Hello , i tried to use this type of conversion but not working
xception in thread "main" java.lang.Error: java.lang.Error: Unresolved compilation problem:
The method formatDate(String, Date) is undefined for the type TalendDate
at kiteaproject.extractionkt_0_1.extractionKT.tFileInputExcel_1Process(extractionKT.java:1412)
at kiteaproject.extractionkt_0_1.extractionKT.runJobInTOS(extractionKT.java:1586)
at kiteaproject.extractionkt_0_1.extractionKT.main(extractionKT.java:1457)
Caused by: java.lang.Error: Unresolved compilation problem:
The method formatDate(String, Date) is undefined for the type TalendDate
disconnected
at routines.system.FormatterUtils.format_Date(FormatterUtils.java:21)
at kiteaproject.extractionkt_0_1.extractionKT.tFileInputExcel_1Process(extractionKT.java:1288)
... 2 more
Job extractionKT ended at 10:59 24/04/2011.
One Star

Re: Int to Date

Hello,
it seems the field you are passing is defined as String in your flow, not as Integer.
If so you should convert it from String to int first
One Star

Re: Int to Date

here is my painful problem,
when i convert from string to int
the output cells relative to date is 01-01-1970.
thanks
Community Manager

Re: Int to Date

Hi
when i convert from string to int

How do you convert string to integer/int now?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Int to Date

i use tcovert to conevrt string to integer and after i use tmap to convert integer to date
thanks