pyspark.sql.functions.timestamp_micros#
- pyspark.sql.functions.timestamp_micros(col)[source]#
Creates timestamp from the number of microseconds since UTC epoch.
New in version 3.5.0.
See also
Examples
>>> spark.conf.set("spark.sql.session.timeZone", "UTC")
>>> import pyspark.sql.functions as sf >>> df = spark.createDataFrame([(1230219000,), (1280219000,)], ['micros']) >>> df.select('*', sf.timestamp_micros('micros')).show(truncate=False) +----------+------------------------+ |micros |timestamp_micros(micros)| +----------+------------------------+ |1230219000|1970-01-01 00:20:30.219 | |1280219000|1970-01-01 00:21:20.219 | +----------+------------------------+
>>> spark.conf.unset("spark.sql.session.timeZone")