Categories: Date/Time, Conversion
CONVERT_TIMEZONE
Convert timestamp to the specified timezone.
Syntax
CONVERT_TIMEZONE([sourceTimezone string], destinationTimezone string, timestamp date, timestamp, or string in ISO 8601 format) → timestamp
- sourceTimezone (optional): The time zone of the timestamp. If you omit this parameter, Dremio assumes that the source time zone is UTC.
- destinationTimezone: The time zone to convert the timestamp to.
- timestamp: The timestamp to convert
Examples
CONVERT_TIMEZONE exampleselect convert_timezone('America/Los_Angeles', 'America/New_York', '2021-04-01 15:27:32')
-- 2021-04-01 18:27:32
select convert_timezone('America/Los_Angeles', 'America/New_York', timestamp '2021-04-01 15:27:32');
-- 2021-04-01 18:27:32
select convert_timezone('PST', 'EST', '2021-04-01 15:27:32')
-- 2021-04-01 18:27:32
select convert_timezone('America/Los_Angeles', 'America/New_York', '2021-04-01')
-- 2021-04-01 03:00:00
select convert_timezone('America/Los_Angeles', 'America/New_York', date '2021-04-01')
-- 2021-04-01 03:00:00
select convert_timezone('EDT', '2021-04-01 15:27:32')
-- 2021-04-01 11:27:32
select convert_timezone('PST', '+02:00', '2021-04-01 15:27:32')
-- 2021-04-02 01:27:32
Usage Notes
- The
sourceTimezone
anddestinationTimezone
parameters may betimezone_name
fromsys.project.timezone_names
,timezone_abbrev
fromsys.project.timezone_abbrevs
, or a UTC time offset such as "+02:00". - If you specify a time zone name instead of time offset, you may get a different answer depending on when you call this function due to daylight saving time.