Share via


make_time

Create time from hour, minute and second fields. For invalid inputs it will throw an error.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.make_time(hour=<hour>, minute=<minute>, second=<second>)

Parameters

Parameter Type Description
hour pyspark.sql.Column or str The hour to represent, from 0 to 23.
minute pyspark.sql.Column or str The minute to represent, from 0 to 59.
second pyspark.sql.Column or str The second to represent, from 0 to 59.999999.

Returns

pyspark.sql.Column: A column representing the created time.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(6, 30, 45.887)], ["hour", "minute", "second"])
df.select(dbf.make_time("hour", "minute", "second").alias("time")).show()