How to convert date format?

Hi,

I'm trying to read data from an excel file and I have a "date" column which has the "MM/DD/YYYY" format.

I need to put this data into MySQL, where the supported format is "YYYY-MM-DD"

How can I convert it? If I create a variable in tMap component, I've seen there is a "parseDate" function within "TalendDate" functions category. I think that's what need to use, but I cannot really understand how.

Please advise.

Thanks

rdoe's picture
76
Joined: Jul 12 2009 - 2:53pm
Last seen: 13 years 8 months ago

1 Answer:

With the TalendDate.parseDate() function you should be able to convert your date.

In your case it'll look something like:

TalendDate.parseDate("MM/dd/yyyy",row1.Date)

Then in the output table you just enter "yyyy-MM-dd" format in the "Date Pattern" field.

Cheers,

Stas

stasp's picture
39768
Joined: Jun 3 2009 - 9:53am
Last seen: 1 hour 55 min ago
Feedback