pyspark.sql.functions.
weekofyear
Extract the week number of a given date as integer.
New in version 1.5.0.
Examples
>>> df = spark.createDataFrame([('2015-04-08',)], ['dt']) >>> df.select(weekofyear(df.dt).alias('week')).collect() [Row(week=15)]