Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mitz
Contributor III

How to convert Dates to YYYYMMDD" format

Hi,

I would like to get some help on the issue I am trying to fix.

I am using the tMap component and trying to convert the date value of a column from "yyyy-MM-dd'T'HH:mm:ss'.000Z'" to "yyyymmdd" date format. I tried to use the syntax below but it won't work. 

TalendDate.formatDate("yyyymmdd",row1.DateStamp) 

I even changed the Data Type to String in the tMap Output still it won't work.

If I forced the required format ("yyyymmdd") in the "Date Pattern" field in tMap it was giving me an incorrect value such as "20213912" instead of "20220612".

Do you have any idea on this how to fix it?

Thank you much in advance.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hello Mitz,

Regarding to your above error, seems the input column type is 'Date'? if yes, please setup the tMap output value to row1.DateStamp as the below

0695b00000YDMDYAA5.png

View solution in original post

4 Replies
Anonymous
Not applicable

Hello,

in the tMap output, you can setup the column value to TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",row1.DateStamp ) , the column type to 'Date' with Date pattern: "yyyyMMdd" as the below

0695b00000YDLchAAH.png 

Mitz
Contributor III
Author

Thank you so much, Achen.

I tried to apply your solution but, I got the error below.

0695b00000YDMC1AAP.png0695b00000YDMBwAAP.png

Anonymous
Not applicable

Hello Mitz,

Regarding to your above error, seems the input column type is 'Date'? if yes, please setup the tMap output value to row1.DateStamp as the below

0695b00000YDMDYAA5.png

Mitz
Contributor III
Author

Thanks Achen.

It works now. Thanks for your help. 👍