snowflake.snowpark.functions.to_utc_timestamp¶

snowflake.snowpark.functions.to_utc_timestamp(e: Union[Column, str], tz: Union[Column, None, bool, int, float, str, bytearray, Decimal, date, datetime, time, bytes, NaTType, float64, list, tuple, dict]) → Column[source]¶

Interprets an input expression as a timestamp and converts from given time zone to UTC.

Note

Time zone names are case-sensitive. Snowflake does not support the majority of timezone abbreviations (e.g. PDT, EST, etc.). Instead you can specify a time zone name or a link name from release 2021a of the IANA Time Zone Database (e.g. America/Los_Angeles, Europe/London, UTC, Etc/GMT, etc.). See the following for more information: <https://data.iana.org/time-zones/tzdb-2021a/zone1970.tab> <https://data.iana.org/time-zones/tzdb-2021a/backward>

Example::
>>> df = session.create_dataframe(['2019-01-31 01:02:03.004'], schema=['t'])
>>> df.select(to_utc_timestamp(col("t"), "America/Los_Angeles").alias("ans")).collect()
[Row(ANS=datetime.datetime(2019, 1, 31, 9, 2, 3, 4000))]
Copy
Example::
>>> df = session.create_dataframe([('2019-01-31 01:02:03.004', "America/Los_Angeles")], schema=['t', 'tz'])
>>> df.select(to_utc_timestamp(col("t"), col("tz")).alias("ans")).collect()
[Row(ANS=datetime.datetime(2019, 1, 31, 9, 2, 3, 4000))]
Copy