pyspark.sql.functions.current_timestamp

pyspark.sql.functions.current_timestamp() → pyspark.sql.column.Column[source]

Returns the current timestamp at the start of query evaluation as a TimestampType column. All calls of current_timestamp within the same query return the same value.

New in version 1.5.0.

Changed in version 3.4.0: Supports Spark Connect.

Returns
Column

current date and time.

Examples

>>> df = spark.range(1)
>>> df.select(current_timestamp()).show(truncate=False) 
+-----------------------+
|current_timestamp()    |
+-----------------------+
|2022-08-26 21:23:22.716|
+-----------------------+