snowflake.snowpark.functions.time_from_parts¶
- snowflake.snowpark.functions.time_from_parts(hour: Union[Column, str, int], minute: Union[Column, str, int], second: Union[Column, str, int], nanoseconds: Optional[Union[Column, str, int]] = None) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L4794-L4824)¶
Creates a time from individual numeric components.
TIME_FROM_PARTS is typically used to handle values in “normal” ranges (e.g. hours 0-23, minutes 0-59), but it also handles values from outside these ranges. This allows, for example, choosing the N-th minute in a day, which can be used to simplify some computations.
Example:
>>> df = session.create_dataframe( ... [[11, 11, 0, 987654321], [10, 10, 0, 987654321]], ... schema=["hour", "minute", "second", "nanoseconds"], ... ) >>> df.select(time_from_parts( ... "hour", "minute", "second", nanoseconds="nanoseconds" ... ).alias("TIME_FROM_PARTS")).collect() [Row(TIME_FROM_PARTS=datetime.time(11, 11, 0, 987654)), Row(TIME_FROM_PARTS=datetime.time(10, 10, 0, 987654))]