<?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 Nifi UpdateAttribute Date formatation in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-UpdateAttribute-Date-formatation/m-p/181159#M70734</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;how can I get from a String like this "20170115" a date format, that I can put in a cassandra collumn with date format?&lt;/P&gt;&lt;P&gt;I tried in updateAttribute processor this ${column.2:toDate("yyyy/MM/dd", "GMT")} but it didnt worked.&lt;/P&gt;&lt;P&gt;column.2 is a csv column with values like "20170115".&lt;/P&gt;&lt;P&gt;thx for help&lt;/P&gt;</description>
    <pubDate>Sat, 04 Nov 2017 15:46:00 GMT</pubDate>
    <dc:creator>jiayu_g3turbo</dc:creator>
    <dc:date>2017-11-04T15:46:00Z</dc:date>
    <item>
      <title>Nifi UpdateAttribute Date formatation</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-UpdateAttribute-Date-formatation/m-p/181159#M70734</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;how can I get from a String like this "20170115" a date format, that I can put in a cassandra collumn with date format?&lt;/P&gt;&lt;P&gt;I tried in updateAttribute processor this ${column.2:toDate("yyyy/MM/dd", "GMT")} but it didnt worked.&lt;/P&gt;&lt;P&gt;column.2 is a csv column with values like "20170115".&lt;/P&gt;&lt;P&gt;thx for help&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 15:46:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-UpdateAttribute-Date-formatation/m-p/181159#M70734</guid>
      <dc:creator>jiayu_g3turbo</dc:creator>
      <dc:date>2017-11-04T15:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi UpdateAttribute Date formatation</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-UpdateAttribute-Date-formatation/m-p/181160#M70735</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/46253/jiayug3turbo.html" nodeid="46253"&gt;@Andy Gisbo&lt;/A&gt;&lt;/P&gt;&lt;P&gt;if your column.2 attribute having value as &lt;STRONG&gt;"20170115"&lt;/STRONG&gt; //with double quotes surrounded.&lt;/P&gt;&lt;P&gt;you need to remove double quotes before todate function, try the below Expression in your update attribute processor.&lt;/P&gt;&lt;PRE&gt;${column.2:replaceAll('"',''):toDate("yyyyMMdd","GMT")} //first replace double quotes with empty value and then parse column.2 value to date and convert that to GMT.&lt;/PRE&gt;&lt;P&gt;In addition if you want to format &lt;STRONG&gt;"20170115"&lt;/STRONG&gt; to "&lt;STRONG&gt;2017-01-15"&lt;/STRONG&gt; then&lt;/P&gt;&lt;PRE&gt;${column.2:replaceAll('"',''):toDate("yyyyMMdd","GMT"):format("yyyy-MM-dd"):append('"'):prepend('"')} //converting column.2 to gmt format then append and prepend the value with "(double quotes)&lt;/PRE&gt;&lt;P&gt;In addition if you want to format &lt;STRONG&gt;"20170115"&lt;/STRONG&gt; to &lt;STRONG&gt;2017-01-15&lt;/STRONG&gt; then &lt;/P&gt;&lt;PRE&gt;${column.2:replaceAll('"',''):toDate("yyyyMMdd"):format("yyyy-MM-dd")}&lt;/PRE&gt;&lt;P&gt;2.if your column.2 attribute having value as&lt;STRONG&gt; 20170115 &lt;/STRONG&gt;//without double quotes&lt;/P&gt;&lt;P&gt;Change the expression in update attribute processor as below&lt;/P&gt;&lt;PRE&gt;${column.2:toDate("yyyyMMdd", "GMT")} &lt;/PRE&gt;&lt;P&gt;This expression will return GMT value.&lt;/P&gt;&lt;P&gt;In addition if you want to format 20170115 to 2017-01-15 then &lt;/P&gt;&lt;PRE&gt;${column.2:toDate("yyyyMMdd","GMT"):format("yyyy-MM-dd")}&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;what if still doesn't work?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Goto Right top corner&lt;/STRONG&gt; on you NiFi UI and click on &lt;STRONG&gt;GlobalMenu&lt;/STRONG&gt;(i.e you can see three horizontal lines at top right corner)&lt;/P&gt;&lt;P&gt;Click on&lt;STRONG&gt; Help&lt;/STRONG&gt; then click on &lt;STRONG&gt;Expression Language Guide&lt;/STRONG&gt; and look for &lt;STRONG&gt;toDate&lt;/STRONG&gt; function is it supports &lt;STRONG&gt;converting to GMT &lt;/STRONG&gt;format or not. Because these conversion to GMT format is not supported in NiFi 1.1.0 version.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 20:16:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-UpdateAttribute-Date-formatation/m-p/181160#M70735</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2017-11-04T20:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi UpdateAttribute Date formatation</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-UpdateAttribute-Date-formatation/m-p/181161#M70736</link>
      <description>&lt;P&gt;thx for the answer, it worked perfectly.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 20:42:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-UpdateAttribute-Date-formatation/m-p/181161#M70736</guid>
      <dc:creator>jiayu_g3turbo</dc:creator>
      <dc:date>2017-11-04T20:42:09Z</dc:date>
    </item>
  </channel>
</rss>

