pyspark.sql.functions.last_day

pyspark.sql.functions.last_day(date: ColumnOrName) → pyspark.sql.column.Column[source]

Returns the last day of the month which the given date belongs to.

New in version 1.5.0.

Examples

>>> df = spark.createDataFrame([('1997-02-10',)], ['d'])
>>> df.select(last_day(df.d).alias('date')).collect()
[Row(date=datetime.date(1997, 2, 28))]