talend

Using Date in Talend

Parsing a date

Parsing date is used when having an input typed as String and when it is needed to get it as a Date. The class TalendDate contains method TalendDate.parseDate("pattern","stringDate").

Pattern here is the input pattern, and not the expected output pattern.

Usage : For an input string like "2017-05-03 17:09:00" , the call will be :

TalendDate.parseDate("yyyy-MM-dd HH:mm:ss","2017-05-03 17:09:00")

The result could be a date like :

2017-05-03 17:09:00 

or

03/05/2017

Depending on the output pattern which is defined outside the parseDate method.

Define date pattern in the output settings of the schema

Automatic date parsing

Since Talend 6.3 , an option in tMap allows to automatically convert types. When activated, output pattern is used as the expected input pattern to automatically convert data.

First, activate the option :

Modify default settings

Enable auto-conversion

Then modify output pattern, used as the input pattern :

enter image description here


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow