Hello Talend experts.
I have a daily csv file that is arriving without the year. I have come up with the following expression in tmap to correct this:
TalendDate.parseDate("yyyy MMM dd hh:mm:ss", TalendDate.getDate("CCYY") + " " + row2.Timestamp)
The issue I am looking for help on is what to do on January 1 when I run this script. With the above expression, the new year date will be concatenated to the date string instead of the previous years. Is there a way to fix this?
Solved! Go to Solution.
The function TalendDate.addDate returns the wrong date when Dec 31st is entered. It should return 20171231, but it returns 20181231 instead. All other dates work fine except for Dec 31st.
Here is my function: TalendDate.formatDate("YYYYMMdd",TalendDate.addDate(TalendDate.getCurrentDate(),-context.VP_days_back,"DD")));
When I run it on: Jan 2nd, 2018
passing in 1
passing in 2
status_File_Name_Date: 20181231 ****INCORRECT****
passing in 3
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Part 2 of a series on Context Variables
Learn how to do cool things with Context Variables
Find out how to migrate from one database to another using the Dynamic schema