pyspark.sql.functions.timestamp_seconds

pyspark.sql.functions.timestamp_seconds(col: ColumnOrName) → pyspark.sql.column.Column[source]

New in version 3.1.0.

Examples

>>> from pyspark.sql.functions import timestamp_seconds
>>> spark.conf.set("spark.sql.session.timeZone", "America/Los_Angeles")
>>> time_df = spark.createDataFrame([(1230219000,)], ['unix_time'])
>>> time_df.select(timestamp_seconds(time_df.unix_time).alias('ts')).show()
+-------------------+
|                 ts|
+-------------------+
|2008-12-25 07:30:00|
+-------------------+
>>> spark.conf.unset("spark.sql.session.timeZone")