Skip to main content
Solved

Cannot convert Epoch time to human datetime

  • April 15, 2022
  • 3 replies
  • 486 views

jhu_20
Contributor
Forum|alt.badge.img+7

I have GeoJason data from USGS site which contains Epoch time such as 1650016756409 or 1649948565590. I tried to read them in either %s$ or %Es% using DateTimeConverter, all failed and cannot convert. I am using FME desktop 2021.2. Please help.

Best answer by nielsgerrits

According to the documentation %s or %Es are expected to be in seconds. When checking your datetimestamps with an epoch converter on the internet, they appear to be in milliseconds. I know this because I have had the same problem :)

You can convert from milliseconds to seconds using the ExpressionEvaluator or an AttributeCreator using 

@Evaluate(@Value(datetime_epoch_miliseconds)/1000)

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

jhu_20
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • April 15, 2022

I received Fme_rejection_code as "Invalid_input". Please help. Thanks.


nielsgerrits
VIP
Forum|alt.badge.img+64
  • Best Answer
  • April 15, 2022

According to the documentation %s or %Es are expected to be in seconds. When checking your datetimestamps with an epoch converter on the internet, they appear to be in milliseconds. I know this because I have had the same problem :)

You can convert from milliseconds to seconds using the ExpressionEvaluator or an AttributeCreator using 

@Evaluate(@Value(datetime_epoch_miliseconds)/1000)

 


jhu_20
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • April 15, 2022

nielsgerrits,

Thanks for your suggestions and it works perfectly. It is exactly the problem you suggested. I resolved the issue using your suggestion.