Dates in TMap

One Star

Dates in TMap

Could someone help me please, i am struggling to sort this issue out. I am using Tmap to do a date comparison. I am using two dates in format dd/MM/yyyy. I need to compare only the MM/yyyy and not read in the dd.
For some reason i think its not working. i used this statement in my Tmap
TalendDate.compareDate(myDate,myDate2,"MM/yyyy") == 0
i have two entries like this
file delimited = 12/01/2010
MySqlInput(lookup table) = 00/01/2010
i want to compare the two dates using only the month and year , if they are the same i want to pass to the next stage. the record is actually being passed to the error file for some reason the match aint taking place.
Could someone help me with this problem please.
If possible can i compare a string and just the MM/yyyy from date at all.
my input file also has a column with just mm/yyyy but it is a varchar as it is coming from a mysql table and then the lookup table doesnt have this it only has a date dd/MM/yyyy. If i cant use the date compare first option above can i compare the string value and date value in TMap at all. Please help.

many thanks
Six Stars

Re: Dates in TMap

I'm not sure what are you trying to do... you should post you tmap screenshot.
anyway if you want to lookup a table based by a "MM/yyyy" string key, just use TalendDate.parsedate to obtain the relevant string part...
One Star

Re: Dates in TMap

You could try the Talend routine dateCompare or reformat the dates for comparison.
One Star

Re: Dates in TMap

i have a input file with date column as format december 1, 2013
and i m using TalendDate.parseDate("MMM dd, yyyy",row2.ReviewDate) in tmap and it is not working please help

Re: Dates in TMap

Hi shersushant,
"MMM" is for "Dec" and"MMMM" is "December".
Best regards
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.


Talend named a Leader.

Get your copy


Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables


How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration


Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach