Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
stebizard
Partner - Contributor
Partner - Contributor

how DATE datatype is stored in Talend.

Hello,

I'd like to understand how DATE datatype is stored in Talend.

Is it an internal proprietary format or is it stored as a string with a specific format ( a combinaison of Y M D H Mi SS ...) ?

I suppose it is the second solution as DATE is accompanied everywhere by a

display formatting like "yyyyMMdd"

But to my mind, a "DATE" format should not be accompanied by such a format.

For me, this generates confusion in the head of people because I am regularly asked what is the format of the DATE in my database and they do not understand that I refuse to answer something like "yyyyMMdd" or some thing like that.

Labels (2)
1 Reply
prg
Employee
Employee

Hello @Stephane BIZARD​ ,

 

Please note that in java, TalendDate routines allow you to carry out different kinds of operations and checks concerning the format of Date expressions.

 

Help Documentation;

https://help.talend.com/r/QrWkwPvKmKybs~JNLeBt3Q/GF6kKOHdJwnnbGY_b6u02g

 

Although "yyyy" and "YYYY" in the date format return the same year number in most cases, "YYYY" may not work as expected when used:

  • at the first week of a year if the year does not start by the first day of the week.
  • at the last week of a year if the year does not end by the last day of the week.

For example, when calculating what date it is 3 days before January 2, 2016, the code below would return a wrong date:

System.out.println(TalendDate.formatDate("YYYY-MM-dd", TalendDate.addDate(TalendDate.TO_DATE("01/02/2016 08:10:30.123"), -3, "dd")));

while the following code would work as expected:

System.out.println(TalendDate.formatDate("yyyy-MM-dd", TalendDate.addDate(TalendDate.TO_DATE("01/02/2016 08:10:30.123"), -3, "dd")));

Therefore, you should typically use "yyyy", which represents calendar year.

 

Regards,

Vaishnavi