Created 10-30-2015 02:41 AM
According to the docs ${now()} should yeild
"current date and time as the number of milliseconds since Midnight GMT on January 1, 1970."
Which sounds like a Unix epoch style timestamp in miliseconds
but what I actually receive is Fri Oct 30 02:36:08 UTC 2015
Does now() have options I am missing?
Created 10-30-2015 01:08 PM
Wade, this is a documentation bug. The now() statement returns a Date object, not a long epoch, one more step required. E.g. consider this expression which gets 'yesterday':
${now():toNumber():minus(86400000):format('yyyy-MM-dd')}
You can follow https://issues.apache.org/jira/browse/NIFI-1078
Created 10-30-2015 01:08 PM
Wade, this is a documentation bug. The now() statement returns a Date object, not a long epoch, one more step required. E.g. consider this expression which gets 'yesterday':
${now():toNumber():minus(86400000):format('yyyy-MM-dd')}
You can follow https://issues.apache.org/jira/browse/NIFI-1078
Created 11-03-2015 08:24 PM
Thanks Andrew ${now();toNumber():Divide(1000)} got me what I needed.
Created 05-07-2020 01:09 AM
Hello all, I'm new here.
wondered if any of you could help me. I am trying to create a flow in Nifi to stop any incorrect timestamps getting out of Nifi (i.e. to HDFS or Splunk).
I want to capture any epoch timestamp 24hours in the future or 7 days in the past. I have created a processor that takes all timestamp formats back to epoch (as attribute named 'timestamp'. I then want to minus the timestamp from 'now' then use the 'gt' and 'lt' functions to return a true/false against another attribute I have made called ,valid_timestamp'.
first of all, can anyone help me minus my timestamp (value) from 'now'?
${now():toNumber():minus(timestamp(attibute value))
I spent the whole day yesterday trying to get this to work.. I'm sure there is a more straight forward way to achieve what I am after, any advice would be much appreciated.
Andy
Created 05-08-2020 12:11 PM
I'd strongly encourage you to start a new question rather then asking for help on an existing question with an already accepted solution. You'll get better traction and visibility that way.
Matt