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

snowflake.snowpark.functions.to_date

snowflake.snowpark.functions.to_date(e: ColumnOrName, fmt: Column | None = None) Column[source]

Converts an input expression into a date.

Example:

>>> df = session.create_dataframe(['2013-05-17', '2013-05-17'], schema=['a'])
>>> df.select(to_date(col('a')).as_('ans')).collect()
[Row(ANS=datetime.date(2013, 5, 17)), Row(ANS=datetime.date(2013, 5, 17))]

>>> df = session.create_dataframe(['31536000000000', '71536004000000'], schema=['a'])
>>> df.select(to_date(col('a')).as_('ans')).collect()
[Row(ANS=datetime.date(1971, 1, 1)), Row(ANS=datetime.date(1972, 4, 7))]
Copy