Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
Even Better if you use the TalendDate library