Skip to main content
Solved

How to convert a timestamp?

  • September 15, 2017
  • 4 replies
  • 623 views

Forum|alt.badge.img

I 'am reading a Json file that contains a timestamp. I need to convert this to a date so that I can aggregate other data on Year, Month.

I've tried using an attributemananger (@value/86400)+25569+(-5/24) and DatConverter to convert the timestamp but this didn't gave me any results.

Therefore my question how to do this?

Best answer by redgeographics

If it's the seconds since the Unix epoch you can use the DateTimeConvertor. Source format is %s, output format can be FME or ISO date, whichever you prefer.

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.

4 replies

david_r
Celebrity
  • 8394 replies
  • September 15, 2017

What is the format of the timestamp in your json? It would be helpful if you could post an example here.


Forum|alt.badge.img
  • Author
  • 6 replies
  • September 18, 2017

This is an example of a timestamp. "lastUpdated":1502349196

But additional: In my attributemanager I am using the Arithmetic editor. This results in a number.

Do I have to do something to convert this back to a string? I thought I read something that FME automatically convert this when needed.


redgeographics
Celebrity
Forum|alt.badge.img+60
  • Celebrity
  • 3704 replies
  • Best Answer
  • September 18, 2017

If it's the seconds since the Unix epoch you can use the DateTimeConvertor. Source format is %s, output format can be FME or ISO date, whichever you prefer.


Forum|alt.badge.img
  • Author
  • 6 replies
  • September 18, 2017

If it's the seconds since the Unix epoch you can use the DateTimeConvertor. Source format is %s, output format can be FME or ISO date, whichever you prefer.

Ok, I feel a bit stupid now. I've read the help but it didn't came up to me that I could change the Source Date Format. This works (of course)! Thanks.