Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
RA6
Creator
Creator

Compare Dates

Hello guys,

I need to compare the current_date with the dates below to check if it is more than 80 years or not.

Input :

1845-03-05 =>yes

1735-01-30

=>yes

2023-03-03

=>no

Any ideas how to do that,

Best regards,

Duke

Labels (2)
3 Replies
gjeremy1617088143
Master
Master

hi Duke, you can use Java.Time Library :

 

import java.time.LocalDate;

 

LocalDate start = LocalDate.of( 1845 , 3 , 5 ) ;

LocalDate stop = LocalDate.now();

long years = java.time.temporal.ChronoUnit.YEARS.between( start , stop );

if(years > 80)

{

here the result you want

}

 

Send me Love and Kudos

 

 

Anonymous
Not applicable

Hi

You can use the built-in function TalendDate.diffDate(Date date1, Date date2, String dateType) to get the difference between two dates, for more details about this function, go to Respository-->Code-->System-->TalendDate.

 

Regards

Shong

gjeremy1617088143
Master
Master

Even Better if you use the TalendDate library