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

snowflake.snowpark.functions.unix_timestamp

snowflake.snowpark.functions.unix_timestamp(e: Union[Column, str], fmt: Optional[Column] = None) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L8423-L8439)

Converts a timestamp or a timestamp string to Unix time stamp (in seconds).

Example:

>>> import datetime
>>> df = session.create_dataframe([["2013-05-08T23:39:20.123-07:00"]], schema=["ts_col"])
>>> df.select(unix_timestamp(col("ts_col")).alias("unix_time")).show()
---------------
|"UNIX_TIME"  |
---------------
|1368056360   |
---------------
Copy
Language: English