Skip to main content
Solved

Timezone

  • May 2, 2018
  • 5 replies
  • 494 views

Forum|alt.badge.img

Hello, I have an Timestamp attribute in UTC time (e.g. 20180311013252.000). I would like to create a new attribute converting the UTC Timestamp to EST/EDT Time. After that both attributes should be transformed to %Y%m%d. In this example the output should be 20180311 for UTC and 20180310 for EDT/EST.

Best answer by takashi

Hi @kat, if you are using FME 2017.1+, you can use the @TimeZoneSet function to convert timezone of a datetime value. e.g.

@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00)

You can then format the datetime values with the DateTimeConverter transformer.

The @DateTimeFormat function can also be used instead of the DateTimeConverter transformer.

@DateTimeFormat(@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00),%Y%m%d)

See also here to learn more about FME Date/Time functions.

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.

5 replies

takashi
Celebrity
  • 7843 replies
  • Best Answer
  • May 2, 2018

Hi @kat, if you are using FME 2017.1+, you can use the @TimeZoneSet function to convert timezone of a datetime value. e.g.

@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00)

You can then format the datetime values with the DateTimeConverter transformer.

The @DateTimeFormat function can also be used instead of the DateTimeConverter transformer.

@DateTimeFormat(@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00),%Y%m%d)

See also here to learn more about FME Date/Time functions.


danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • May 3, 2018

Hi @kat, if you are using FME 2017.1+, you can use the @TimeZoneSet function to convert timezone of a datetime value. e.g.

@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00)

You can then format the datetime values with the DateTimeConverter transformer.

The @DateTimeFormat function can also be used instead of the DateTimeConverter transformer.

@DateTimeFormat(@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00),%Y%m%d)

See also here to learn more about FME Date/Time functions.

Great solution and tutorial :)

 

 


Forum|alt.badge.img
  • Author
  • 28 replies
  • May 3, 2018

Hi @kat, if you are using FME 2017.1+, you can use the @TimeZoneSet function to convert timezone of a datetime value. e.g.

@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00)

You can then format the datetime values with the DateTimeConverter transformer.

The @DateTimeFormat function can also be used instead of the DateTimeConverter transformer.

@DateTimeFormat(@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00),%Y%m%d)

See also here to learn more about FME Date/Time functions.

Wow, that's great! Thanks a lot.

 

Does it consider daylight saving time (-5 in winter and -4 in summer) or it must be changed manually?

 

 


takashi
Celebrity
  • 7843 replies
  • May 3, 2018

Hi @kat, if you are using FME 2017.1+, you can use the @TimeZoneSet function to convert timezone of a datetime value. e.g.

@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00)

You can then format the datetime values with the DateTimeConverter transformer.

The @DateTimeFormat function can also be used instead of the DateTimeConverter transformer.

@DateTimeFormat(@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00),%Y%m%d)

See also here to learn more about FME Date/Time functions.

If the timezone setting of your machine was EST/EDT, this expression would automatically determine the local time.

 

@TimeZoneSet(@Value(_utc_datetime)+00:00,local)
Otherwise, you will have to implement a process to switch the timezone (-04:00 or -05:00) according to the input date.

 


Forum|alt.badge.img
  • 2 replies
  • July 31, 2019

Hi @kat, if you are using FME 2017.1+, you can use the @TimeZoneSet function to convert timezone of a datetime value. e.g.

@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00)

You can then format the datetime values with the DateTimeConverter transformer.

The @DateTimeFormat function can also be used instead of the DateTimeConverter transformer.

@DateTimeFormat(@TimeZoneSet(@Value(_utc_datetime)+00:00,-04:00),%Y%m%d)

See also here to learn more about FME Date/Time functions.

Is there a way to automatically take into account DST without "local"? I'm creating a model that will run on a server in one time zone but will need to be able to convert the time to PST/PDT automatically.