<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic TalendDate.formatDate - Incorrect Year result in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/TalendDate-formatDate-Incorrect-Year-result/m-p/2298510#M70963</link>
    <description>&lt;P&gt;Hello Talend experts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a daily csv&amp;nbsp;file that is arriving without the year. I have come up with the following expression in tmap to&amp;nbsp;correct this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TalendDate.parseDate("yyyy MMM dd hh:mm:ss", TalendDate.getDate("CCYY") + " " + row2.Timestamp)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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&amp;nbsp;to the date string instead of the previous years. Is there a way to fix this?&lt;/P&gt;</description>
    <pubDate>Thu, 19 Oct 2017 14:29:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-10-19T14:29:58Z</dc:date>
    <item>
      <title>TalendDate.formatDate - Incorrect Year result</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TalendDate-formatDate-Incorrect-Year-result/m-p/2298510#M70963</link>
      <description>&lt;P&gt;Hello Talend experts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a daily csv&amp;nbsp;file that is arriving without the year. I have come up with the following expression in tmap to&amp;nbsp;correct this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TalendDate.parseDate("yyyy MMM dd hh:mm:ss", TalendDate.getDate("CCYY") + " " + row2.Timestamp)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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&amp;nbsp;to the date string instead of the previous years. Is there a way to fix this?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 14:29:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TalendDate-formatDate-Incorrect-Year-result/m-p/2298510#M70963</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-19T14:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: TalendDate.formatDate - Incorrect Year result</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TalendDate-formatDate-Incorrect-Year-result/m-p/2298511#M70964</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could just replace &lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;TalendDate.g&lt;/SPAN&gt;etDate("CCYY")&lt;/FONT&gt;&amp;nbsp;with the following, which&amp;nbsp;will return the year for yesterday's date:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TalendDate.formatDate("yyyy", TalendDate.addDate(TalendDate.getCurrentDate(), -1, "dd"))&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 14:48:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TalendDate-formatDate-Incorrect-Year-result/m-p/2298511#M70964</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-19T14:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: TalendDate.formatDate - Incorrect Year result</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TalendDate-formatDate-Incorrect-Year-result/m-p/2298512#M70965</link>
      <description>&lt;P&gt;&lt;SPAN&gt;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.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my function: TalendDate.formatDate("YYYYMMdd",TalendDate.addDate(TalendDate.getCurrentDate(),-context.VP_days_back,"DD")));&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;System.out.println("status_File_Name_Date: "+globalMap.get("status_File_Name_Date"));&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run it on: Jan 2nd, 2018&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;passing in 1&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;status_File_Name_Date: 20180101&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2018-01-02 11:11:03|zBVARx|zBVARx|zBVARx|5904|EDA|addDate_test|_5xWZIO_eEeerDMq08aFbSQ|0.1|CERT||end|success|479&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[statistics] disconnected&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;passing in 2&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;status_File_Name_Date: 20181231 ****INCORRECT****&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;2018-01-02 11:07:59|w3opZP|w3opZP|w3opZP|12616|EDA|addDate_test|_5xWZIO_eEeerDMq08aFbSQ|0.1|CERT||end|success|674&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[statistics] disconnected&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;passing in 3&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;status_File_Name_Date: 20171230&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2018-01-02 11:09:08|WpgMSb|WpgMSb|WpgMSb|3760|EDA|addDate_test|_5xWZIO_eEeerDMq08aFbSQ|0.1|CERT||end|success|500&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[statistics] disconnected&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 19:38:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TalendDate-formatDate-Incorrect-Year-result/m-p/2298512#M70965</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-02T19:38:57Z</dc:date>
    </item>
  </channel>
</rss>

