TalendDate.diffDate ==> no days between March 27th and March 28th ?

One Star

TalendDate.diffDate ==> no days between March 27th and March 28th ?

Hi,

I have a little problem, when I use the TalendDate.diffDate function, in order to count the number of days between January, 1st 2011 and today.
The TalendDate.diffDate function seems to forget a day in March...
I may be crazy, but when I use the following instruction in a tMap, I have the same answer for March 27th and March 28th :

TalendDate.diffDate(TalendDate.parseDate("yyyy-MM-dd","2011-03-26"),TalendDate.parseDate("yyyy-MM-dd","2011-01-01"),"dd")
==> 84
TalendDate.diffDate(TalendDate.parseDate("yyyy-MM-dd","2011-03-27"),TalendDate.parseDate("yyyy-MM-dd","2011-01-01"),"dd")
==> 85
TalendDate.diffDate(TalendDate.parseDate("yyyy-MM-dd","2011-03-28"),TalendDate.parseDate("yyyy-MM-dd","2011-01-01"),"dd")
==> 85 ???

I use TOS 4.1.1.r50363
Thank you for your help.
One Star

Re: TalendDate.diffDate ==> no days between March 27th and March 28th ?

My colleagues foud the bug : it's about the time shift for summer...
It happended during the night of the 27th to the 28th...
The function can be used, but I need to specify the hours in the date... One hour less minimum in the second date...
For example :
TalendDate.diffDate(TalendDate.parseDate("yyyy-MM-dd-HH","2011-03-28-16"),TalendDate.parseDate("yyyy-MM-dd-HH","2011-01-01-15"),"dd")
==> 86 ==> CORRECT !

You can see the problem using the function with the differences in hours :
TalendDate.diffDate(TalendDate.parseDate("yyyy-MM-dd","2011-03-28"),TalendDate.parseDate("yyyy-MM-dd","2011-01-01"),"HH")
==> 2063 (we miss an hour to reach 2064 hours i.e. 86 days expected)

Many thanks to Nicolas and Jean-Noël...

Anyone for the Talend team ? This bug is understandable, but may be serious : I use this function to calculate Julian Dates that would be wrong from this week...
One Star

Re: TalendDate.diffDate ==> no days between March 27th and March 28th ?

Hello,
I would like to know how I do in Talend to calculate the age of a person from his birth date and the current date?
I used this code:
TalendDate.diffDate(TalendDate.parseDate("dd-MM-yyyyy","11-08-2013"),TalendDate.parseDate("dd-MM-yyyyy","20-01-2000"),"dd")
I'd like it to be dynamic I do not know if we can do that.??
TalendDate.diffDate(TalendDate.parseDate("dd-MM-yyyyy","TalendDate.getCurrentDate()"),TalendDate.parseDate("dd-MM-yyyyy","row6.dateNaiss"),"dd")
But it shows me an error: Type mismatch: can not convert long to float
Thank you in advance
Seven Stars

Re: TalendDate.diffDate ==> no days between March 27th and March 28th ?

Don't post the same question more than once - http://www.talendforge.org/forum/viewtopic.php?id=31157.
Five Stars

Re: TalendDate.diffDate ==> no days between March 27th and March 28th ?

have you found some solution for this bug ?

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now