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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
peterko
Contributor III
Contributor III

Compare Dates

Hello,
how do I compare two dates?
I would like something like this in my tMap:
TalendDate.compareDate(TalendDate.getDate("dd-MM-yyyy"), row1.service_date, "dd-MM-yyyy") > 0 ? TalendDate.getDate("dd-MM-yyyy") : row1.service_date

where row1.service_date is a date, and I save the result to columns of type date.
But I still writes error "Exception in thread" main "java.lang.Error: unresolved compilation problems"
Labels (3)
11 Replies
Anonymous
Not applicable

Hi iam new to talend

 

i need to compare dates but iam getting error while using below qury in tmap

 

TalendDate.compareDate(load_src.acctr_eff_dt <= context.i_DATA_DATE && load_src.acctr_exp_dt >= context.i_DATA_DATE)?"Y":"N"

 

---- value of context.i_DATA_DATE=2018-12-31 

Anonymous
Not applicable

@ris.tan

 

   Please try the below logic and I got the output as shown below.

 

0683p000009M2kG.png

0683p000009M2u9.png

 

The tMap expression used in the output column is as shown below.

 

(TalendDate.compareDate(row1.acctr_eff_dt,context.i_DATA_DATE)<=0 && TalendDate.compareDate(row1.acctr_exp_dt,context.i_DATA_DATE)>=0)?"Y":"N" 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂