EQL provides two functions to obtain the corresponding timestamp
in different timezones.
EQL supports the standard IANA Time Zone database (
https://www.iana.org/time-zones).
- TO_TZ Takes
a timestamp in GMT, looks up the GMT offset for the specified timezone at that
time in GMT, and then returns a timestamp adjusted by that offset. If the
specified timezone does not exist, the result is NULL. For example,
TO_TZ(dateTime,'America/New_York') answers the
question, "What time was it in America/New_York when it was
dateTime in GMT?"
- FROM_TZ
Takes a timestamp in the specified timezone, looks up the GMT offset for the
specified timezone at that time, and then returns a timestamp adjusted by that
offset. If the specified timezone does not exist, the result is NULL. For
example,
FROM_TZ(dateTime,'EST') answers the question, "What
time was it in GMT when it was
dateTime in EST?"
The following table shows the results of several timezone expressions:
Expression
|
Results
|
TO_TZ(TO_DATETIME('2012-07-05T16:00:00.000Z'),
'America/New_York')
|
2012-07-05T12:00:00.000Z
|
TO_TZ(TO_DATETIME('2012-01-05T16:00:00.000Z'),
'America/New_York')
|
2012-01-05T11:00:00.000Z
|
FROM_TZ(TO_DATETIME('2012-07-05T16:00:00.000Z'),
'America/Los_Angeles')
|
2012-07-05T23:00:00.000Z
|
FROM_TZ(TO_DATETIME('2012-01-05T16:00:00.000Z'),
'America/Los_Angeles')
|
2012-01-06T00:00:00.000Z
|