snowflake.snowpark.functions.as_timestamp_ntz

snowflake.snowpark.functions.as_timestamp_ntz(variant: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L6213-L6227)

Casts a VARIANT value to a TIMESTAMP with no timezone.

Example:

>>> from snowflake.snowpark.functions import as_timestamp_ntz, to_variant
>>> df = session.sql("select TO_TIMESTAMP_NTZ('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_ntz(df.alarm_v).as_("alarm")).collect() == df.select(df.alarm).collect()
True
Copy
语言: 中文