pyspark.sql.functions.make_time#

pyspark.sql.functions.make_time(hour, minute, second)[source]#

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

Added in version 4.1.0.

Parameters:
hourColumn or column name

The hour to represent, from 0 to 23. A column that evaluates to an integer.

minuteColumn or column name

The minute to represent, from 0 to 59. A column that evaluates to an integer.

secondColumn or column name

The second to represent, from 0 to 59.999999. A column that evaluates to a decimal.

Returns:
Column

A column representing the created time. Returns a column that evaluates to a time.

Examples

>>> from pyspark.sql import functions as sf
>>> df = spark.createDataFrame([(6, 30, 45.887)], ["hour", "minute", "second"])
>>> df.select(sf.make_time("hour", "minute", "second").alias("time")).show()
+------------+
|        time|
+------------+
|06:30:45.887|
+------------+