Skip to main content
Solved

Timezone


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.

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

5 replies

takashi
Influencer
  • 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
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • May 3, 2018
takashi wrote:

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
  • May 3, 2018
takashi wrote:

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
Influencer
  • May 3, 2018
takashi wrote:

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
  • July 31, 2019
takashi wrote:

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.


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