Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
jwing
Contributor
Contributor

Compare date not outputing expected results

Hi All,

I'm trying to compare the last modified date of a file with todays date. I am expecting the output to be -1 because the documentation states "...-1 if the first date is earlier..."

Jan 18 at 06:46:30 is earlier than Jan 18 00:00:00...so why does the compareDate output a 1 instead of a -1? Is there something I am missing?

Any feedback is much appreciated!

0693p00000BDnvSAAT.png

0693p00000BDnu5AAD.png

0693p00000BDnuyAAD.png

Doc:

https://help.talend.com/r/DDjlr2GHaTAASHk4QPrCDw/drLRG4tDnucYg6H2Au0myQ

0693p00000BDnuoAAD.png

Labels (2)
3 Replies
Fabio_Caimi
Contributor II
Contributor II

Hi jwing!

You have 2 dates: Jan 18 06:46:30 and Jan 18 00:00:00

Those are times of the same day: the first date is 6 hours after the second, that's why compareDate output is 1 (correct).

Maybe you wish to test if file_date is by midnight (before January 19)? If so, you could set today_date + 1day to go at 00:00 of the next day, in this way you're covered until 11.59.59 of January 18.

 

jwing
Contributor
Contributor
Author

Hi Fabio,

 

Sorry for the late reply, was very busy of of late. Appreciate the response! I tried another scenario and wanted to see the output if I revise the file date but kept the today_date the same. Both are outputting -1 when the file data is before and after today_date. Do you know why the 2nd screenshot below doesn't show 1 ?

 

jwing
Contributor
Contributor
Author

0693p00000ATrWAAA1.png0693p00000ATrX3AAL.png