how to compare date in talend

how to compare date in talend

I have a input date(As KEY) and a lookup file
the lookup file has two colomn start_date and end_date on the basis of these two colomn
we have to update a,b and c
THE senario is like this if my input date fall on the range of these two colmn's of lookup file we have to update a,b and c
input date :28-07-2003
lokup file:
start date end date a b c
28-06-2003 25-07-2003 200307 3 2003
01-01-2010 29-01-2010 201001 1 2010
26-09-2015 30-10-2015 201510 4 2015
28-03-2009 24-04-2009 200904 2 2009

how could i do this please give the solution
thank you in advance.
kind regards
Shailendra s.
One Star

Re: how to compare date in talend

Hi Shailendra,
you can use the tIntervalMatch component to lookup the date in the ranges (check the help-file for more info).
One Star

Re: how to compare date in talend

Hi Shailendra,
step 1. Take lookup start date
step 2. do increment in loop till end date
step 3. check whether date is equivalent to input date or not
long l =TalendDate.diffDate(end_date, start_date);
globalMap.put("iterate", l);
select : for
from : 0
to: (Long)globalMap.get("iterate")
tjava: =
System.out.println("DATE " +;
TalendDate.compareDate(end_date, start_date,"dd-MM-yyyy")==0 ? Match : not match

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now


Introduction to Talend Open Studio for Data Integration.


Downloads and Trials

Test drive Talend's enterprise products.


Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.