pyspark.sql.functions.
last_day
Returns the last day of the month which the given date belongs to.
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
target column to compute on.
last day of the month.
Examples
>>> df = spark.createDataFrame([('1997-02-10',)], ['d']) >>> df.select(last_day(df.d).alias('date')).collect() [Row(date=datetime.date(1997, 2, 28))]