snowflake.snowpark.functions.to_date¶
- snowflake.snowpark.functions.to_date(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#L3293-L3308)¶
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))]