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

snowflake.snowpark.functions.as_timestamp_ltz¶

snowflake.snowpark.functions.as_timestamp_ltz(variant: Union[Column, str]) → Column[source]¶

Casts a VARIANT value to a TIMESTAMP with a local timezone.

Example:

>>> from snowflake.snowpark.functions import as_timestamp_ltz, to_variant
>>> df = session.sql("select TO_TIMESTAMP_LTZ('2018-10-10 12:34:56') as alarm")
>>> df.alarm_v = to_variant(df.alarm)
>>> df.select(df.alarm_v.as_("alarm")).collect() == df.select(df.alarm).collect()
False
>>> df.select(as_timestamp_ltz(df.alarm_v).as_("alarm")).collect() == df.select(df.alarm).collect()
True
Copy