Solved

Timezone


Badge

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.

icon

Best answer by takashi 3 May 2018, 00:48

View original

5 replies

Userlevel 2
Badge +17

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.

Userlevel 4
Badge +30

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 :)

 

 

Badge

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?

 

 

Userlevel 2
Badge +17

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.

 

Badge

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.

Reply