Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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:
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