Search code examples
apache-nifi

Convert epoch timestamp to normal timestamp in nifi


I want to convert the epoch timestamp to a normal timestamp.

i have tried ${field.value:format('MM/dd/yyyy HH:mm:ss.SSS')} in update attribute it give some wrong date in 1970 for the value 1625777940


Solution

  • if you have epoch timestamp in seconds then converting it to java is simply multiply by 1000 because java counts time in milliseconds since 1/1/1970 (the same base as unix).

    so, this should work:

    ${field.value:multiply(1000):format('MM/dd/yyyy HH:mm:ss.SSS')}