pyspark.sql.functions.dayname#
- pyspark.sql.functions.dayname(col)[source]#
Date and Timestamp Function: Returns the three-letter abbreviated day name from the given date.
New in version 4.0.0.
- Parameters
- col
Column
or str target date/timestamp column to work on.
- col
- Returns
Column
the three-letter abbreviation of day name for date/timestamp (Mon, Tue, Wed…)
Examples
Example 1: Basic usage of dayname function.
>>> import pyspark.sql.functions as sf >>> df = spark.createDataFrame([('2015-04-08',)], ['dt']) >>> df.select(sf.dayname('dt').alias('dayname')).show() +-------+ |dayname| +-------+ | Wed| +-------+