This function is used to convert a UTC timestamp to a UNIX timestamp in a given time zone.
from_utc_timestamp(string timestamp, string timezone)
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
timestamp |
Yes |
DATE STRING TINYINT SMALLINT INT BIGINT |
Time to be converted Date value of the DATE or STRING type, or timestamp of the TINYINT, SMALLINT, INT, or BIGINT type. The following formats are supported: yyyy-mm-dd yyyy-mm-dd hh:mi:ss yyyy-mm-dd hh:mi:ss.ff3 |
timezone |
Yes |
STRING |
Time zone where the time to be converted belongs |
The return value is of the TIMESTAMP type.
The value 1691978400000 is returned, indicating 2023-08-14 10:00:00.
select from_utc_timestamp('2023-08-14 17:00:00','PST');
The value 1691917200000 is returned, indicating 2023-08-13 17:00:00.
select from_utc_timestamp(date '2023-08-14 00:00:00','PST');
The value NULL is returned.
select from_utc_timestamp('2023-08-13',null);