pyspark.sql.functions.last_day#
- pyspark.sql.functions.last_day(date)[source]#
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.
Examples
>>> df = spark.createDataFrame([('1997-02-10',)], ['d']) >>> df.select(last_day(df.d).alias('date')).collect() [Row(date=datetime.date(1997, 2, 28))]