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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get number of months between Two dates

Hello Gurus,

 

I am new to Talend Integration. Need your help to resolve one of Development issues. I have two columns TRDNG_DT and DLVRY_DT. I will have to count number of months between the dates. For Example, Field TRDNG_DT = 14.11.2019 and DLVRY_DT = 01.04.2020. First, I will have to set the TRDNG_DT set to 01.11.2019 and then start count the number of months and load into Target field. I can able to capture number of days but how-to capture the months. 

 

Please let me know.

 

Thanks,

Nag

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Use builtin function TalendDate.dateDiff

 

Date date1 = new SimpleDateFormat("dd.MM.yyyy").parse("14.11.2019");
Date date2 = new SimpleDateFormat("dd.MM.yyyy").parse("01.11.2019");
System.out.println(TalendDate.diffDate(date1, date2,"MM")); //0 months

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Use builtin function TalendDate.dateDiff

 

Date date1 = new SimpleDateFormat("dd.MM.yyyy").parse("14.11.2019");
Date date2 = new SimpleDateFormat("dd.MM.yyyy").parse("01.11.2019");
System.out.println(TalendDate.diffDate(date1, date2,"MM")); //0 months
Anonymous
Not applicable
Author

Hello Evansdar, thanks for your prompt solution 0683p000009MACn.png