Skip to main content
MRFRANQ
Gold ⭐️
December 13, 2021
Solved

Change timestamp format micro to millis on NiFi

I get a file with multiple dates in the following format: 2021-08-25T12:34:48.984704 which is in micro format. How could I change these dates on the nifi to stay in millis? I tried the following: Apache Nifi Expression Language - toDate formatting formatting but I was not successful in the configuration. I believe that the answer is cohort, but I am not managing to make it work.

MRFRANQ
MRFRANQAnswer
Gold ⭐️
December 15, 2021

I managed to solve it, I used ${field.value:substring(0,23):toDate("yyyy-MM-dd'T'HH:mm:ss.SSS"):format("yyyy-MM-dd HH:mm: ss.SSS")}

1 reply

MRFRANQ
MRFRANQAuthorAnswer
Gold ⭐️
December 15, 2021

I managed to solve it, I used ${field.value:substring(0,23):toDate("yyyy-MM-dd'T'HH:mm:ss.SSS"):format("yyyy-MM-dd HH:mm: ss.SSS")}

Translate