snowflake.snowpark.functions.weekofyear¶
- snowflake.snowpark.functions.weekofyear(e: Union[Column, str]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L6090-L6106)¶
Extracts the corresponding week (number) of the year from a date or timestamp.
Example:
>>> import datetime >>> df = session.create_dataframe( ... [[datetime.datetime.strptime("2020-05-01 13:11:20.000", "%Y-%m-%d %H:%M:%S.%f")]], ... schema=["a"], ... ) >>> df.select(weekofyear("a")).collect() [Row(WEEKOFYEAR("A")=18)]