<?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 unix timestamp to datetime in Apache NiFi? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-convert-unix-timestamp-to-datetime-in-Apache-NiFi/m-p/224741#M186605</link>
    <description>&lt;P&gt;
	Hi &lt;A nodeid="76211" rel="user" href="#"&gt;@Wojtek&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;
	I believe the problem is that the format() function works only with numbers. Your timestamp has a '.' (dot) which makes it interpret as a string.&lt;/P&gt;&lt;P&gt;
	To solve the problem I have adopted the following EL un a updateAttribute processor:&lt;/P&gt;&lt;PRE&gt;${ts:substringBefore('.'):append(${ts:substringAfter('.')})
	:toNumber():format('MM/dd/yyyy HH:mm:ss.SSS')
}
&lt;P&gt;&lt;/P&gt;&lt;P&gt;ts attribute contains this value 1518442283.483&lt;/P&gt;&lt;P&gt;the result is 02/12/2018 13:31:23.483&lt;/P&gt;&lt;P&gt;I hope I have been of help&lt;/P&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 23 Apr 2018 17:42:19 GMT</pubDate>
    <dc:creator>isoardi</dc:creator>
    <dc:date>2018-04-23T17:42:19Z</dc:date>
  </channel>
</rss>

