通过


current_timestamp

以列的形式 TimestampType 返回查询评估开始时的当前时间戳。 同一查询中current_timestamp的所有调用都返回相同的值。

有关相应的 Databricks SQL 函数,请参阅 current_timestamp 函数

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.current_timestamp()

退货

pyspark.sql.Column:当前日期和时间。

例子

from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.current_timestamp()).show(truncate=False)