tHMap date format for JSON

Six Stars

tHMap date format for JSON

Hello everyone,

I am using a tHMap to create a JSON object for a webservice. The webservice requires the following date format:

yyyy-MM-dd'T'HH:mm:ss'Z'

I cannot find this specific date format in the Date Formats of the structure. I neither could find a way to define a custom date format. Thus, I am using "Default" as date format at the moment and defined the desired format in the Talend Data Integration schema, which is used as the input for the tHMap. As a result I get the following date format:

yyyy-MM-dd'T'HH:mm:ss.SSS

 

Hence, my question: How can the date format of the tHMap JSON output be changed or customized?

Regards,

Tobi

Nine Stars

Re: tHMap date format for JSON

in tMap you can try this 

 

DateFormat.PNG

Regards,

Veeru Boppudi
Six Stars

Re: tHMap date format for JSON

Hi vboppudi,

thank you for your input. I know how to do it in a tMap, this would be my workaround: Transforming the dates to a string and passing it to the tHMap as string. But from my point of view this is only a workaround and not an ideal solution, as I always have to do a null-safe explicit transformation instead of passing the values through.

Regards.

Highlighted
Four Stars

Re: tHMap date format for JSON

Were you able to resolve this? Can you help me?

Six Stars

Re: tHMap date format for JSON

Hi varmav2,

we followed the suggested way in a tMap. Not the solution we wished for, but we are doing fine with it. We wrote a custom routine "getDateTimeString" and "getDateString", which returns the date null-safe in the desired string format. I suppose there is no better solution to this. Definitely not in the tHMap, we only use it for 1:1 document transformation (Talend > JSON, JSON > Talend, XML > Talend, etc.) without any field operations.

Hope this helps.

Regards

Tobias

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog