Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Extracts seconds from TIME value (returns DECIMAL to preserve fractional seconds).
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.time_to_seconds(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
TIME value to convert. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.sql("SELECT TIME'14:30:00.5' as time")
df.select(dbf.time_to_seconds('time')).show()
+---------------------+
|time_to_seconds(time)|
+---------------------+
| 52200.500000|
+---------------------+