Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Extracts seconds from TIME value (returns DECIMAL to preserve fractional seconds).
Syntax
from pyspark.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.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|
+---------------------+