One Star

Datatype Conversion

Hello Talend Folks,
I am new to Talend and trying to accomplish some intermediate operations in TMAP Component. I need to convert the data types in TMAP to work through my tasks.
I need to convert from String - > Number ; String - > NVarchar2 ; String -> Timestamp ; String -> Date
Any help on the above is deeply appreciated.
Thanks
psreepa
3 REPLIES
One Star

Re: Datatype Conversion

Hi Psreepa
Welcome to Talend Community!
String->Number: String->Int
Integer.parseInt(s)
String->NVarchar2:
No need to change.
String->Timestamp and String->Date: String->Date
TalendDate.parseDate(pattern, stringDate)
Regards,
Pedro
One Star

Re: Datatype Conversion

Thanks for your quick response, Pedro.
I am getting an error after using TalendDate.parseDate("dd-mmm-yy",row2.Column0) . Do I also need to pick the date pattern? Source record is lik 2012-01-31 and my end result should look like 31-JAN-12.
Thx
Psreepa
One Star

Re: Datatype Conversion

Hi
You can change date pattern in tMap as the following image.
Regards,
Pedro