<?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 2018- to convert into hive in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/2018-to-convert-into-hive/m-p/225472#M75114</link>
    <description />
    <pubDate>Wed, 28 Feb 2018 12:22:16 GMT</pubDate>
    <dc:creator>Gayathridevi</dc:creator>
    <dc:date>2018-02-28T12:22:16Z</dc:date>
    <item>
      <title>2018- to convert into hive</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/2018-to-convert-into-hive/m-p/225472#M75114</link>
      <description />
      <pubDate>Wed, 28 Feb 2018 12:22:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/2018-to-convert-into-hive/m-p/225472#M75114</guid>
      <dc:creator>Gayathridevi</dc:creator>
      <dc:date>2018-02-28T12:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: 2018- to convert into hive</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/2018-to-convert-into-hive/m-p/225473#M75115</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/39249/gayathrimtechcse.html" nodeid="39249"&gt;@Gayathri Devi&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Could you try with below query as we are reading &lt;STRONG&gt;2018-02-27T02:00&lt;/STRONG&gt; value and converting as &lt;STRONG&gt;timestamp value&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Query:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select from_unixtime(unix_timestamp('2018-02-27T02:00',"yyyy-MM-dd'T'hh:mm"),'yyyy-MM-dd hh:mm:ss');
+----------------------+--+
|         _c0          |
+----------------------+--+
| 2018-02-27 02:00:00  |
+----------------------+--+&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;(or)&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;By using regexp_replace function we can replace T in your timestamp value&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select regexp_replace('2018-02-27T02:00','T',' ');
+-------------------+--+
|        _c0        |
+-------------------+--+
| 2018-02-27 02:00  |
+-------------------+--+&lt;/PRE&gt;&lt;P&gt;And use concat function to add missing :00 value to make above value as hive timestamp.&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select concat(regexp_replace('2018-02-27T02:00','T',' '),":00");
+----------------------+--+
|         _c0          |
+----------------------+--+
| 2018-02-27 02:00:00  |
+----------------------+--+&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Feb 2018 20:46:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/2018-to-convert-into-hive/m-p/225473#M75115</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-02-28T20:46:03Z</dc:date>
    </item>
  </channel>
</rss>

