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:
- hour
Columnor column name The hour to represent, from 0 to 23. A column that evaluates to an integer.
- minute
Columnor column name The minute to represent, from 0 to 59. A column that evaluates to an integer.
- second
Columnor column name The second to represent, from 0 to 59.999999. A column that evaluates to a decimal.
- hour
- Returns:
ColumnA 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| +------------+