<?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>question Re: convert ISO8601 date in d mm yyhh mm ss format in Hive in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/convert-ISO8601-date-in-d-mm-yyhh-mm-ss-format-in-Hive/m-p/122361#M85117</link>
    <description>&lt;P&gt;if I am using above function getting null . Please reply &lt;/P&gt;</description>
    <pubDate>Thu, 23 Nov 2017 13:46:42 GMT</pubDate>
    <dc:creator>theepireddysant</dc:creator>
    <dc:date>2017-11-23T13:46:42Z</dc:date>
    <item>
      <title>convert ISO8601 date in d mm yyhh mm ss format in Hive</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-ISO8601-date-in-d-mm-yyhh-mm-ss-format-in-Hive/m-p/122359#M85115</link>
      <description>&lt;P&gt;My date looks like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;2016-09-13T06:03:51Z&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I need to convert it in dd-mm-YYYY hh:mm:ss format. HOw do I do it?&lt;/P&gt;&lt;P&gt;I tried:&lt;/P&gt;&lt;PRE&gt;from_unixtime(unix_timestamp(created_at , 'dd-MM-yyyy HH-mm-ss'))&lt;/PRE&gt;&lt;P&gt;but it didnot work and gives null&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 17:07:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-ISO8601-date-in-d-mm-yyhh-mm-ss-format-in-Hive/m-p/122359#M85115</guid>
      <dc:creator>simran_k</dc:creator>
      <dc:date>2016-10-10T17:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: convert ISO8601 date in d mm yyhh mm ss format in Hive</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-ISO8601-date-in-d-mm-yyhh-mm-ss-format-in-Hive/m-p/122360#M85116</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/10486/simrank.html" nodeid="10486"&gt;@Simran Kaur&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;You can still achieve this using out-of-the-box functions in Hive as you mentioned. You just missed getting the string in the right format. For clarity, the basic steps are: &lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;Replace the 'T' in the string with a space so the date is in the format expected by Hive. &lt;/LI&gt;&lt;LI&gt;Convert the string to a unix timestamp using the unix_timestamp function.&lt;/LI&gt;&lt;LI&gt;Convert the timestamp to your preferred date format using the from_unixtime function. &lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here is a quick example you can run in Hive to see the result for the string you provided:&lt;/P&gt;&lt;PRE&gt;select from_unixtime(unix_timestamp(regexp_replace('2016-09-13T06:03:51Z', 'T',' ')), 'dd-MM-yyyy HH-mm-ss');&lt;/PRE&gt;&lt;P&gt;Notice that the only additional step is the replace operation.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2016 03:05:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-ISO8601-date-in-d-mm-yyhh-mm-ss-format-in-Hive/m-p/122360#M85116</guid>
      <dc:creator>bwilson</dc:creator>
      <dc:date>2016-10-11T03:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: convert ISO8601 date in d mm yyhh mm ss format in Hive</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-ISO8601-date-in-d-mm-yyhh-mm-ss-format-in-Hive/m-p/122361#M85117</link>
      <description>&lt;P&gt;if I am using above function getting null . Please reply &lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 13:46:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-ISO8601-date-in-d-mm-yyhh-mm-ss-format-in-Hive/m-p/122361#M85117</guid>
      <dc:creator>theepireddysant</dc:creator>
      <dc:date>2017-11-23T13:46:42Z</dc:date>
    </item>
  </channel>
</rss>

