Created on 12-24-2018 05:43 AM - edited 09-16-2022 07:00 AM
Hi,
Can anyone shed some light on this, please.
having:
attribute 'epochdatetime' Value: '1545266262' and
using:
UpdateAttribute to create new variable 'converteddatetime' with
${epochdatetime:format("yyyy/MM/dd HH:mm:ss.SSS'Z'", "GMT")}
gives:
converteddatetime' Value: '1970/01/18 21:14:26.262Z'
instead of: December 20, 2018/12/20 12:37:42......
Created 12-24-2018 08:21 AM
Hi @A Sabatino,
I am not sure why you expect the date resulting from your epoch value. So from what I can see, your value is not what you expect, the conversion is fine.
In the API documentation (https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#dates) it is desribed, that the value ist interpreted in milliseconds from 1. January 1970 00:00:00 GMT. Now when interpreting '1 545 266 262', it results in something like 17.8 days. So a time on the 18. January 1970 seems to be the correct result. To me it appears as if you lost a factor of 1000 somewhere in your epoch value.
Regards
Harald
Created 12-24-2018 08:21 AM
Hi @A Sabatino,
I am not sure why you expect the date resulting from your epoch value. So from what I can see, your value is not what you expect, the conversion is fine.
In the API documentation (https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#dates) it is desribed, that the value ist interpreted in milliseconds from 1. January 1970 00:00:00 GMT. Now when interpreting '1 545 266 262', it results in something like 17.8 days. So a time on the 18. January 1970 seems to be the correct result. To me it appears as if you lost a factor of 1000 somewhere in your epoch value.
Regards
Harald
Created 12-24-2018 09:28 AM
Hi Harald
You are right - we passed in the epoch in seconds rather than milliseconds !
Many thanks
Regards
Aniello
Created 12-24-2018 09:37 AM
Hi @A Sabatino,
thanks for the info. Would be great if you click on 'accept' for the answer. Helps everyone to see the issue is resolved and provides you and me with a reward in terms of reputation points 🙂
Regards
Harald
Created 02-07-2022 07:28 PM
Hi @A Sabatino,
I am also facing same issue for Value: '1643667489'
Could you please share complete syntax for the epoch(1643667489) in second....
Created 02-07-2022 09:56 PM
Hi @AshuGang as this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.
Regards,
Vidya Sargur,