Skip to main content
Solved

How to convert a timestamp?

  • September 15, 2017
  • 4 replies
  • 492 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.

View original
Did this help you find an answer to your question?

4 replies

david_r
Evangelist
  • 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
  • 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+48
  • Celebrity
  • 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
  • September 18, 2017
redgeographics wrote:

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.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings