You are viewing documentation about an older version (1.12.1). View latest version

snowflake.snowpark.functions.from_utc_timestamp

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

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

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(from_utc_timestamp(col("t"), "America/Los_Angeles").alias("ans")).collect()
[Row(ANS=datetime.datetime(2019, 1, 30, 17, 2, 3, 4000))]
Copy
Example::
>>> df = session.create_dataframe([('2019-01-31 01:02:03.004', "America/Los_Angeles")], schema=['t', 'tz'])
>>> df.select(from_utc_timestamp(col("t"), col("tz")).alias("ans")).collect()
[Row(ANS=datetime.datetime(2019, 1, 30, 17, 2, 3, 4000))]
Copy