snowflake.snowpark.functions.timestamp_ntz_from_parts¶
- snowflake.snowpark.functions.timestamp_ntz_from_parts(date_expr: ColumnOrName, time_expr: ColumnOrName, _emit_ast: bool = True) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L5990-L6022)¶
- snowflake.snowpark.functions.timestamp_ntz_from_parts(year: Union[ColumnOrName, int], month: Union[ColumnOrName, int], day: Union[ColumnOrName, int], hour: Union[ColumnOrName, int], minute: Union[ColumnOrName, int], second: Union[ColumnOrName, int], nanosecond: Optional[Union[ColumnOrName, int]] = None, _emit_ast: bool = True) Column
Creates a timestamp from individual numeric components. The function can be used to create a timestamp from a date expression and a time expression.
Example 1:
>>> df = session.create_dataframe( ... [[2022, 4, 1, 11, 11, 0], [2022, 3, 31, 11, 11, 0]], ... schema=["year", "month", "day", "hour", "minute", "second"], ... ) >>> df.select(timestamp_ntz_from_parts( ... "year", "month", "day", "hour", "minute", "second" ... ).alias("TIMESTAMP_NTZ_FROM_PARTS")).collect() [Row(TIMESTAMP_NTZ_FROM_PARTS=datetime.datetime(2022, 4, 1, 11, 11)), Row(TIMESTAMP_NTZ_FROM_PARTS=datetime.datetime(2022, 3, 31, 11, 11))]
Example 2:
>>> df = session.create_dataframe( ... [['2022-04-01', '11:11:00'], ['2022-03-31', '11:11:00']], ... schema=["date", "time"] ... ) >>> df.select( ... timestamp_ntz_from_parts(to_date("date"), to_time("time") ... ).alias("TIMESTAMP_NTZ_FROM_PARTS")).collect() [Row(TIMESTAMP_NTZ_FROM_PARTS=datetime.datetime(2022, 4, 1, 11, 11)), Row(TIMESTAMP_NTZ_FROM_PARTS=datetime.datetime(2022, 3, 31, 11, 11))]