pyspark.sql.functions.dayofyear

pyspark.sql.functions.dayofyear(col: ColumnOrName) → pyspark.sql.column.Column

Extract the day of the year of a given date as integer.

Examples

>>> df = spark.createDataFrame([('2015-04-08',)], ['dt'])
>>> df.select(dayofyear('dt').alias('day')).collect()
[Row(day=98)]