Share via


unix_micros

Returns the number of microseconds since 1970-01-01 00:00:00 UTC.

For the corresponding Databricks SQL function, see unix_micros function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.unix_micros(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or str input column of values to convert.

Returns

pyspark.sql.Column: the number of microseconds since 1970-01-01 00:00:00 UTC.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('2015-07-22 10:00:00',), ('2022-10-09 11:12:13',)], ['ts'])
df.select('*', dbf.unix_micros(dbf.to_timestamp('ts'))).show()