Cloud

make_timestamptz

The make_timestamptz() function creates a timestamptz value from separate year, month, day, hour, minute, and second fields, and an optional time zone name. See also make_timestamp() to create a timestamp without a time zone.

Syntax

MAKE_TIMESTAMPTZ(year, month, day, hour, minute, second)
MAKE_TIMESTAMPTZ(year, month, day, hour, minute, second, timezone)

Arguments

  • year: The year, as an integer.

  • month: The month, as an integer from 1 to 12.

  • day: The day of the month, as an integer.

  • hour: The hour, as an integer.

  • minute: The minute, as an integer.

  • second: The second, as a floating-point number (supports fractional seconds).

  • timezone: Optional. The name of the time zone the input fields are in (for example, 'America/New_York'). Defaults to the session’s time zone when omitted.

Return type

timestamptz

Examples

Using the session time zone

This example sets the session time zone to UTC, then omits the timezone argument so the function uses that session setting:

SET TIME ZONE 'UTC';
SELECT MAKE_TIMESTAMPTZ(2026, 9, 1, 13, 45, 30.5);
       make_timestamptz
--------------------------------
 2026-09-01 13:45:30.5+00
(1 row)

Using an explicit time zone

SELECT MAKE_TIMESTAMPTZ(2026, 9, 1, 13, 45, 30.5, 'America/New_York');
       make_timestamptz
--------------------------------
 2026-09-01 13:45:30.5-04
(1 row)