<?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 Convert Datetime to Integer in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Convert-Datetime-to-Integer/m-p/2432146#M140368</link>
    <description>&lt;P&gt;Hi, i need to convert Datetime to Integer in Talend&lt;/P&gt;
&lt;P&gt;- First i convert datetime to string&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TalendDate.formatDate("yyyy-MM-dd HH:mm:ss:SSSS",row4.TimeStamp)&lt;/P&gt;
&lt;P&gt;- Second i convert string to integer&lt;/P&gt;
&lt;P&gt;StringHandling.LEFT(Var.var1,4) ==&amp;gt; as var2 (for getting date in expression)&lt;/P&gt;
&lt;P&gt;Integer.valueOf(Var.var3) ==&amp;gt; (in output table)&lt;/P&gt;
&lt;P&gt;but get wrong like below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asafrian1700127126_0-1710824448201.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/162251i1B6E32B32D4D0C0A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asafrian1700127126_0-1710824448201.png" alt="asafrian1700127126_0-1710824448201.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There is no null data from the original table.&lt;/P&gt;
&lt;P&gt;Then I added the following command and the data was successfully streamed but something went wrong in the YEAR column&amp;nbsp;&lt;BR /&gt;Var.var2!=null?Integer.parseInt(Var.var2):null&lt;/P&gt;
&lt;P&gt;the result&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asafrian1700127126_1-1710824911166.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/162252i6AA62D4163459681/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asafrian1700127126_1-1710824911166.png" alt="asafrian1700127126_1-1710824911166.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The year column contains a NULL value and the data contents in the YEAR column are not aligned with the rows so they do not match the TimeStamp column.&lt;/P&gt;
&lt;P&gt;Can you help to resolve this problem?&lt;/P&gt;</description>
    <pubDate>Tue, 19 Mar 2024 05:14:25 GMT</pubDate>
    <dc:creator>asafrian1700127126</dc:creator>
    <dc:date>2024-03-19T05:14:25Z</dc:date>
    <item>
      <title>Convert Datetime to Integer</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Convert-Datetime-to-Integer/m-p/2432146#M140368</link>
      <description>&lt;P&gt;Hi, i need to convert Datetime to Integer in Talend&lt;/P&gt;
&lt;P&gt;- First i convert datetime to string&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TalendDate.formatDate("yyyy-MM-dd HH:mm:ss:SSSS",row4.TimeStamp)&lt;/P&gt;
&lt;P&gt;- Second i convert string to integer&lt;/P&gt;
&lt;P&gt;StringHandling.LEFT(Var.var1,4) ==&amp;gt; as var2 (for getting date in expression)&lt;/P&gt;
&lt;P&gt;Integer.valueOf(Var.var3) ==&amp;gt; (in output table)&lt;/P&gt;
&lt;P&gt;but get wrong like below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asafrian1700127126_0-1710824448201.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/162251i1B6E32B32D4D0C0A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asafrian1700127126_0-1710824448201.png" alt="asafrian1700127126_0-1710824448201.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There is no null data from the original table.&lt;/P&gt;
&lt;P&gt;Then I added the following command and the data was successfully streamed but something went wrong in the YEAR column&amp;nbsp;&lt;BR /&gt;Var.var2!=null?Integer.parseInt(Var.var2):null&lt;/P&gt;
&lt;P&gt;the result&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asafrian1700127126_1-1710824911166.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/162252i6AA62D4163459681/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asafrian1700127126_1-1710824911166.png" alt="asafrian1700127126_1-1710824911166.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The year column contains a NULL value and the data contents in the YEAR column are not aligned with the rows so they do not match the TimeStamp column.&lt;/P&gt;
&lt;P&gt;Can you help to resolve this problem?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 05:14:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Convert-Datetime-to-Integer/m-p/2432146#M140368</guid>
      <dc:creator>asafrian1700127126</dc:creator>
      <dc:date>2024-03-19T05:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Datetime to Integer</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Convert-Datetime-to-Integer/m-p/2432187#M140369</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the result of year column, there must exist null value in Var.var2. If Var.var1 is null, it generates a null value in Var.var2. For testing, print the value of Var.var1 on the console to see what data it is.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Shicong&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 08:02:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Convert-Datetime-to-Integer/m-p/2432187#M140369</guid>
      <dc:creator>Shicong_Hong</dc:creator>
      <dc:date>2024-03-19T08:02:13Z</dc:date>
    </item>
  </channel>
</rss>

