pyspark.sql.functions.
dayofmonth
Extract the day of the month of a given date/timestamp as integer.
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
target date/timestamp column to work on.
day of the month for given date/timestamp as integer.
Examples
>>> df = spark.createDataFrame([('2015-04-08',)], ['dt']) >>> df.select(dayofmonth('dt').alias('day')).collect() [Row(day=8)]