<?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 parseDateInUTC and formatDateInUTC behave differently in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/parseDateInUTC-and-formatDateInUTC-behave-differently/m-p/2294720#M67567</link>
    <description>&lt;P&gt;parsedateInUTC and formatDateInUTC seem to behave differently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, I'm in the Pacific Time Zone.  So 12 pm PST is 7 pm UTC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I do this:  TalendDate.parseDateInUTC("yyyy-MM-dd HH:mm:ss","2020-09-23 12:00:00"), I get 23-09-2020 05:00:00, which is incorrect.  It's 7 hours backwards instead of forwards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I do this (at 12 pm today): &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss", TalendDate.getCurrentDate() ), I get 2020-09-23 19:00:00, which is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I want a string date passed in converted to the correct UTC date, I have to do this:&lt;/P&gt;&lt;P&gt;TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",&lt;/P&gt;&lt;P&gt;TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss",&lt;/P&gt;&lt;P&gt;TalendDate.parseDate("yyyy-MM-dd HH:mm:ss","2020-09-23 12:00:00")))&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which is crazy - why do I have to parse date twice?   why won't parseDateInUTC work?  What am I missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance!&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 01:24:00 GMT</pubDate>
    <dc:creator>Papademuchos</dc:creator>
    <dc:date>2024-11-16T01:24:00Z</dc:date>
    <item>
      <title>parseDateInUTC and formatDateInUTC behave differently</title>
      <link>https://community.qlik.com/t5/Talend-Studio/parseDateInUTC-and-formatDateInUTC-behave-differently/m-p/2294720#M67567</link>
      <description>&lt;P&gt;parsedateInUTC and formatDateInUTC seem to behave differently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, I'm in the Pacific Time Zone.  So 12 pm PST is 7 pm UTC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I do this:  TalendDate.parseDateInUTC("yyyy-MM-dd HH:mm:ss","2020-09-23 12:00:00"), I get 23-09-2020 05:00:00, which is incorrect.  It's 7 hours backwards instead of forwards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I do this (at 12 pm today): &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss", TalendDate.getCurrentDate() ), I get 2020-09-23 19:00:00, which is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I want a string date passed in converted to the correct UTC date, I have to do this:&lt;/P&gt;&lt;P&gt;TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",&lt;/P&gt;&lt;P&gt;TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss",&lt;/P&gt;&lt;P&gt;TalendDate.parseDate("yyyy-MM-dd HH:mm:ss","2020-09-23 12:00:00")))&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which is crazy - why do I have to parse date twice?   why won't parseDateInUTC work?  What am I missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance!&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:24:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/parseDateInUTC-and-formatDateInUTC-behave-differently/m-p/2294720#M67567</guid>
      <dc:creator>Papademuchos</dc:creator>
      <dc:date>2024-11-16T01:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: parseDateInUTC and formatDateInUTC behave differently</title>
      <link>https://community.qlik.com/t5/Talend-Studio/parseDateInUTC-and-formatDateInUTC-behave-differently/m-p/2294721#M67568</link>
      <description>&lt;P&gt;For those who often forget , AM and PM, java HH is 00-23 and hh 01-12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myJavaUtilDate.toInstant().toString()  // Example: '2020-07-03T10:15:30.120Z'&lt;/P&gt;&lt;P&gt;The&amp;nbsp;&lt;A href="https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html#toString--" alt="https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html#toString--" target="_blank"&gt;toString&lt;/A&gt;&amp;nbsp;implementation uses the&amp;nbsp;&lt;A href="https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#ISO_INSTANT" alt="https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#ISO_INSTANT" target="_blank"&gt;DateTimeFormatter.ISO_INSTANT&lt;/A&gt;&amp;nbsp;format by default&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Look at java's TimeZone format. &lt;/P&gt;&lt;P&gt;And at  &lt;A href="https://stackoverflow.com/questions/51904809/how-to-get-date-format-with-timezone-in-java" alt="https://stackoverflow.com/questions/51904809/how-to-get-date-format-with-timezone-in-java" target="_blank"&gt;stackoverflow&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:54:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/parseDateInUTC-and-formatDateInUTC-behave-differently/m-p/2294721#M67568</guid>
      <dc:creator>Jesperrekuh</dc:creator>
      <dc:date>2020-09-28T11:54:19Z</dc:date>
    </item>
  </channel>
</rss>

