- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Converting Epoch to TimeStamp of specific TimeZone
- Labels:
-
Apache NiFi
Created ‎01-30-2018 12:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to convert the epoch in milliseconds to TimeStamp of specific timezone.
I tried using "format" of nifi expression language as below in updateAttribute processor
${closed_epoch:format("yyyy", "GMT")}
But updateAttribute processor is showing error saying "unexpected token ','.
Is it the bug with Nifi expression language? and what is the timezone that Nifi uses by default when I try ${closed_epoch:format("yyyy")}?
Is there any other way to convert epoch to timestamp of specific timezone ?
Created ‎01-30-2018 12:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What version of NiFi are you using? The timezone parameter was added in NiFi 1.2.0 / HDF 3.0 (NIFI-2908).
Created on ‎01-30-2018 01:53 PM - edited ‎08-17-2019 09:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In addition to Matt's answer if you want to know all supported Functions in Expression Language for your version of NiFi then click on Right Up Corner GlobalMenu Button
And click on Help
3.Then Click on Expression Language Guide
on Right Side will shows up all the functions that are supported in your version of NiFi.
If you want to implement ${closed_epoch:format("yyyy", "GMT")} this expression even though it is not supported in your version of NiFi then as a work around you can use plus,minus functions.
Assuming your closed_epoch attribute value is 1453843201123
${closed_epoch:minus(86400000)} //this expression will minus 86,400,000 Milliseconds(i.e 24 hrs) from closed_epoch value.
New value for closed_epoch will be 1453756801123.
*if you are having DayLightSaving time then you need to change the milliseconds value in minus(or) plus function.
