<?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 Re: I need convert date in same format in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301748#M73818</link>
    <description>&lt;P&gt;This could be a complex problem. Do you know of all of the different types of date format being supplied? Can they be identified easily? For example, if you have the date 01/02/2017 is it 1st Feb 2017 or 2nd Jan 2017? Can you guarantee that a date received like that will be Feb or Jan? If you cannot, then this is not going to be easy. If you can, then you need a list of all of the date formats expected, work out how to identify which is which and write a routine to convert it for you using those rules.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use built in Talend routines to carry out the conversion to a Date type. For example, 01/02/2017 (assuming this is Feb) can be translated to a Date using the following code....&lt;/P&gt;&lt;PRE&gt;routines.TalendDate.parseDate("dd/MM/yyyy", "01/02/2017")&lt;/PRE&gt;&lt;P&gt;Given your example of dates received and assuming a particular date component order (dd/MM/yyyy rather than MM/dd/yyyy) you could identify the type the of date by the presence of a "/" or "-" in the String date.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Oct 2017 14:44:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-10-23T14:44:00Z</dc:date>
    <item>
      <title>I need convert date in same format</title>
      <link>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301747#M73817</link>
      <description>&lt;P&gt;Hi Talend Folks,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;UL&gt; 
 &lt;LI&gt;I have a input excel source like below screenshot format&lt;/LI&gt; 
&lt;/UL&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (111).png" style="width: 251px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrUx.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132642iA5AD8B17ABE41297/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrUx.png" alt="0683p000009LrUx.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;UL&gt; 
 &lt;LI&gt;&amp;nbsp;I need convert all date in same format&amp;nbsp;using talend tool&lt;/LI&gt; 
 &lt;LI&gt;I need convert the date column&amp;nbsp;&lt;SPAN&gt;like below screenshot format&lt;/SPAN&gt;&lt;/LI&gt; 
&lt;/UL&gt; 
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (113).png" style="width: 256px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrRX.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147627iEE2D64E8A9D2A4C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrRX.png" alt="0683p000009LrRX.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Could you plz tell me how to convert date in same format&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 13:37:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301747#M73817</guid>
      <dc:creator>RAJ6</dc:creator>
      <dc:date>2017-10-23T13:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: I need convert date in same format</title>
      <link>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301748#M73818</link>
      <description>&lt;P&gt;This could be a complex problem. Do you know of all of the different types of date format being supplied? Can they be identified easily? For example, if you have the date 01/02/2017 is it 1st Feb 2017 or 2nd Jan 2017? Can you guarantee that a date received like that will be Feb or Jan? If you cannot, then this is not going to be easy. If you can, then you need a list of all of the date formats expected, work out how to identify which is which and write a routine to convert it for you using those rules.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use built in Talend routines to carry out the conversion to a Date type. For example, 01/02/2017 (assuming this is Feb) can be translated to a Date using the following code....&lt;/P&gt;&lt;PRE&gt;routines.TalendDate.parseDate("dd/MM/yyyy", "01/02/2017")&lt;/PRE&gt;&lt;P&gt;Given your example of dates received and assuming a particular date component order (dd/MM/yyyy rather than MM/dd/yyyy) you could identify the type the of date by the presence of a "/" or "-" in the String date.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 14:44:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301748#M73818</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-23T14:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: I need convert date in same format</title>
      <link>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301749#M73819</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;What format (in Excel cell formatting terms) is the data in the "date" column?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Are these values raw strings, maybe imported from a CSV file, or are they dates with different cell formats?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Is the data being manually entered directly into Excel by users, or exported automatically from a system of some sort?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Are you merging several different sources of data into this one sheet, or is being it generated exactly like this&amp;nbsp;as part of an&amp;nbsp;export?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;If it's an export, what options, if any, are you able to customise?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;In cases like this, it would be useful if you could attach a small sample file to your posts, rather than just screen grabs of such a file, so we can see things like formatting, and also to provide a file for testing any example jobs which we may create to illustrate a solution. If I were to create a test file, there's no guarantee that the data would match what you have.&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>Mon, 23 Oct 2017 17:56:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301749#M73819</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-23T17:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: I need convert date in same format</title>
      <link>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301750#M73820</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="UserName lia-user-name lia-user-rank-Five-Stars lia-component-message-view-widget-author-username"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.qlik.com/s/profile/0053p000007LMPMAA4" target="_self"&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
 &lt;LI&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Five-Stars lia-component-message-view-widget-author-username"&gt;&lt;SPAN class=""&gt;Thanks for your reply&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
 &lt;LI&gt;&lt;SPAN&gt;yes, The file&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;exported automatically from a system &lt;/SPAN&gt;&lt;SPAN&gt;from multiple sources data merged into single excel file&lt;/SPAN&gt;&lt;/LI&gt;
 &lt;LI&gt;&lt;SPAN&gt;Date column data type is string format.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 07:01:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301750#M73820</guid>
      <dc:creator>RAJ6</dc:creator>
      <dc:date>2017-10-24T07:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: I need convert date in same format</title>
      <link>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301751#M73821</link>
      <description>&lt;P&gt;In which case, as&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&amp;nbsp;suggests, you can use Talend's date handling functions to convert&amp;nbsp;the string into a date, and then just specify the date format in your output schema.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;As also highlighted, you must be able to guarantee that there are only a limited number of date formats in this column, and that there are none which cannot be uniquely identified.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;If&amp;nbsp;your dates could be in "dd-mm-yyyy" OR "mm-dd-yyyy" format, then there is literally no way to&amp;nbsp;determine from just the data in this field what the date actually is,&amp;nbsp;and&amp;nbsp;you'd need to make changes on the system(s) which are producing this file.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;If the only two formats are "M-d-yyyy" and "dd/MM/yyyy", then you could use&amp;nbsp;a ternary expression in a tMap component:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I've simulated your date stings, with&amp;nbsp;a tFixedFlowInput:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tFixedFlowInput2.png" style="width: 587px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrOg.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/135708i21BA7267C19C3663/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrOg.png" alt="0683p000009LrOg.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;And a tMap component&amp;nbsp;does the work of identifying the format of the string, and converting it to a date:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tMapDateParse.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrWe.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154262i8C88BACF666A3029/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrWe.png" alt="0683p000009LrWe.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;(StringHandling.INDEX(row1.date_string,"/") &amp;gt; 0)
? TalendDate.parseDate("dd/MM/yyyy", row1.date_string)
: TalendDate.parseDate("M-d-yyyy", row1.date_string)&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Note, the field in the input schema is a string,&amp;nbsp;and the one in the output schema is a date, which has the required date format specified,&amp;nbsp;and&amp;nbsp;we get the following output:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Output2.png" style="width: 580px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrWj.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/135672iF4ED15D2A150CF24/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrWj.png" alt="0683p000009LrWj.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 11:35:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/I-need-convert-date-in-same-format/m-p/2301751#M73821</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-24T11:35:26Z</dc:date>
    </item>
  </channel>
</rss>

