<?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: How to convert string to date in NiFi in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-convert-string-to-date-in-NiFi/m-p/191348#M78290</link>
    <description>&lt;A rel="user" href="https://community.cloudera.com/users/866/amillion8.html" nodeid="866" target="_blank"&gt;@Alex M&lt;/A&gt;&lt;P&gt;Use the below expression language to convert into date&lt;/P&gt;&lt;PRE&gt;${&amp;lt;attribute-name&amp;gt;:toDate("MMM dd yyyy hh:mm:ss","GMT"):format("yyyy-MM-dd HH:mm:ss")}&lt;/PRE&gt;&lt;P&gt;in the above expression language we are matching the input date by using toDate function and using format function we are formatting the date value to yyyy-MM-dd HH:mm:ss.&lt;/P&gt;&lt;P&gt;to get only the date then use format function until date i.e yyyy-MM-dd&lt;/P&gt;&lt;PRE&gt;${&amp;lt;attribute-name&amp;gt;:toDate("MMM dd yyyy hh:mm:ss","GMT"):format("yyyy-MM-dd")}&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm having &lt;STRONG&gt;generateflowfile &lt;/STRONG&gt;processor with new property &lt;STRONG&gt;dr&lt;/STRONG&gt; added as &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72840-generateflowfile.png" style="width: 1531px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18429i75B0D14760049B0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72840-generateflowfile.png" alt="72840-generateflowfile.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;UpdateAttribute Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Added two properties in update attribute processor as below&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;gmt
&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${dr:toDate("MMM dd yyyy hh:mm:ss","GMT"):format("yyyy-MM-dd HH:mm:ss")} &lt;/PRE&gt;

&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;not_gmt
&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${dr:toDate("MMM dd yyyy hh:mm:ss"):format("yyyy-MM-dd HH:mm:ss")} &lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72841-updateattr.png" style="width: 1874px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18430i0E65805DCE1329D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72841-updateattr.png" alt="72841-updateattr.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Output Flowfile attributes:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72842-output.png" style="width: 856px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18431i6B4C50180977CCD4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72842-output.png" alt="72842-output.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In addition we can use timezone with format function also,For more details regarding date conversions refer to &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#dates" target="_blank" rel="nofollow noopener noreferrer"&gt;this&lt;/A&gt; link.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;If the Answer addressed your question, &lt;STRONG&gt;Click on Accept button below to accept the answer, &lt;/STRONG&gt;That would be great help to Community users to find solution quickly for these kind of issues.&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 18 Aug 2019 07:28:06 GMT</pubDate>
    <dc:creator>Shu_ashu</dc:creator>
    <dc:date>2019-08-18T07:28:06Z</dc:date>
    <item>
      <title>How to convert string to date in NiFi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-convert-string-to-date-in-NiFi/m-p/191347#M78289</link>
      <description>&lt;P&gt;Is there a simple way to convert a date string such as "Mar 16 2018 19:18:15 GMT" into date in NiFi?&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 18:10:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-convert-string-to-date-in-NiFi/m-p/191347#M78289</guid>
      <dc:creator>amillion8</dc:creator>
      <dc:date>2018-05-15T18:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert string to date in NiFi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-convert-string-to-date-in-NiFi/m-p/191348#M78290</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/866/amillion8.html" nodeid="866" target="_blank"&gt;@Alex M&lt;/A&gt;&lt;P&gt;Use the below expression language to convert into date&lt;/P&gt;&lt;PRE&gt;${&amp;lt;attribute-name&amp;gt;:toDate("MMM dd yyyy hh:mm:ss","GMT"):format("yyyy-MM-dd HH:mm:ss")}&lt;/PRE&gt;&lt;P&gt;in the above expression language we are matching the input date by using toDate function and using format function we are formatting the date value to yyyy-MM-dd HH:mm:ss.&lt;/P&gt;&lt;P&gt;to get only the date then use format function until date i.e yyyy-MM-dd&lt;/P&gt;&lt;PRE&gt;${&amp;lt;attribute-name&amp;gt;:toDate("MMM dd yyyy hh:mm:ss","GMT"):format("yyyy-MM-dd")}&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm having &lt;STRONG&gt;generateflowfile &lt;/STRONG&gt;processor with new property &lt;STRONG&gt;dr&lt;/STRONG&gt; added as &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72840-generateflowfile.png" style="width: 1531px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18429i75B0D14760049B0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72840-generateflowfile.png" alt="72840-generateflowfile.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;UpdateAttribute Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Added two properties in update attribute processor as below&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;gmt
&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${dr:toDate("MMM dd yyyy hh:mm:ss","GMT"):format("yyyy-MM-dd HH:mm:ss")} &lt;/PRE&gt;

&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;not_gmt
&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${dr:toDate("MMM dd yyyy hh:mm:ss"):format("yyyy-MM-dd HH:mm:ss")} &lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72841-updateattr.png" style="width: 1874px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18430i0E65805DCE1329D7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72841-updateattr.png" alt="72841-updateattr.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Output Flowfile attributes:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72842-output.png" style="width: 856px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/18431i6B4C50180977CCD4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72842-output.png" alt="72842-output.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In addition we can use timezone with format function also,For more details regarding date conversions refer to &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#dates" target="_blank" rel="nofollow noopener noreferrer"&gt;this&lt;/A&gt; link.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;If the Answer addressed your question, &lt;STRONG&gt;Click on Accept button below to accept the answer, &lt;/STRONG&gt;That would be great help to Community users to find solution quickly for these kind of issues.&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 07:28:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-convert-string-to-date-in-NiFi/m-p/191348#M78290</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T07:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert string to date in NiFi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-convert-string-to-date-in-NiFi/m-p/191349#M78291</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html"&gt;@Shu&lt;/A&gt; - Thanks for your detailed answer. That helps.&lt;/P&gt;&lt;P&gt;What if I have a timestamp and I need to convert it to a string?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 19:55:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-convert-string-to-date-in-NiFi/m-p/191349#M78291</guid>
      <dc:creator>karthikeyyan_su</dc:creator>
      <dc:date>2019-06-18T19:55:16Z</dc:date>
    </item>
  </channel>
</rss>

