You are viewing documentation about an older version (1.11.1). View latest version

snowflake.snowpark.functions.timestamp_tz_from_parts

snowflake.snowpark.functions.timestamp_tz_from_parts(year: Union[Column, str, int], month: Union[Column, str, int], day: Union[Column, str, int], hour: Union[Column, str, int], minute: Union[Column, str, int], second: Union[Column, str, int], nanoseconds: Optional[Union[Column, str, int]] = None, timezone: Optional[Union[Column, str]] = None) Column[source]

Creates a timestamp from individual numeric components and a string timezone.

Example:

>>> df = session.create_dataframe(
...     [[2022, 4, 1, 11, 11, 0, 'America/Los_Angeles'], [2022, 3, 31, 11, 11, 0, 'America/Los_Angeles']],
...     schema=["year", "month", "day", "hour", "minute", "second", "timezone"],
... )
>>> df.select(timestamp_tz_from_parts(
...     "year", "month", "day", "hour", "minute", "second", timezone="timezone"
... ).alias("TIMESTAMP_TZ_FROM_PARTS")).collect()
[Row(TIMESTAMP_TZ_FROM_PARTS=datetime.datetime(2022, 4, 1, 11, 11, tzinfo=pytz.FixedOffset(-420))), Row(TIMESTAMP_TZ_FROM_PARTS=datetime.datetime(2022, 3, 31, 11, 11, tzinfo=pytz.FixedOffset(-420)))]
Copy