pyspark.sql.functions.day¶
-
pyspark.sql.functions.
day
(col: ColumnOrName) → pyspark.sql.column.Column[source]¶ Extract the day of the month of a given date/timestamp as integer.
New in version 3.5.0.
- Parameters
- col
Column
or str target date/timestamp column to work on.
- col
- Returns
Column
day of the month for given date/timestamp as integer.
Examples
>>> df = spark.createDataFrame([('2015-04-08',)], ['dt']) >>> df.select(day('dt').alias('day')).collect() [Row(day=8)]