Skip to main content
Question

FME2017.1 DateTime Conversion


Hello, any datetime expert out there? I have a dataset in yyyymmddhhmmss format in utc time. Now I am trying to convert it to local time with the consideration of daylight saving. I know the newest version of FME has features that support advanced datetime conversion, but still really confused on this especially with daylight time saving. Before, I have a user parameter to ask the user to manually choose the UTC offset. Now I am trying to upgrade my workspace so that I can get rid of this and have the FME detect my UTC offset automatically. Any ideas? Really appreciate it!!!

4 replies

fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • November 3, 2017

Hi @taliat1105

Please find a workspace attached demonstrating this. You can find the documentation on the Date/Time functions here

 

What we need to do is first tell FME that the date is in the UTC time zone. we can do this by using the command:

@TimeZoneSet(@Value(<unzoned_time_attribute>),utc)

Now that FME knows that it is UTC time we can use a similar call on the new attribute value to convert it to your local time zone

@TimeZoneSet(@Value(<utc_zoned_attribute>),local,convert)

0684Q00000ArL2aQAF.png

 


danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • November 3, 2017

Great solution @MattAtSafe


bruceharold
Contributor
Forum|alt.badge.img+17
  • Contributor
  • November 3, 2017
danilo_fme wrote:

Great solution @MattAtSafe

Are we sure about this? I can't find documentation about daylight saving being respected, after all that is magic in IT terms, the offset is set by politicians at will. I have always resorted to Python to handle the hour each way, see the attached for setting UTC for the contents of a ZIP file which Matt should be familiar with, us both being from the more fortunate hemisphere :-).

 

 

 

unzipldsdownload.py

 

 


  • Author
  • November 3, 2017

Thank you guys for the great idea. I actually managed to convert my data to local time. This feature is great, it cleans up my workspace a lot.


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