Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

Converting Epoch to TimeStamp of specific TimeZone

Rising Star

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 ?


Master Guru

What version of NiFi are you using? The timezone parameter was added in NiFi 1.2.0 / HDF 3.0 (NIFI-2908).

Master Guru

@Anil Reddy

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.