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

snowflake.snowpark.functions.timestamp_tz_from_parts¶

snowflake.snowpark.functions.timestamp_tz_from_parts(year: ColumnOrName | int, month: ColumnOrName | int, day: ColumnOrName | int, hour: ColumnOrName | int, minute: ColumnOrName | int, second: ColumnOrName | int, nanoseconds: ColumnOrName | int | None = None, timezone: ColumnOrLiteralStr | None = 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