pyspark.sql.functions.dayofmonth

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

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

Examples

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