MAKE_TIMESTAMP()

All functions > DATE AND TIME > MAKE_TIMESTAMP()

Builds a TIMESTAMP from its calendar and clock components, given as six arguments or as a ROW.

Signatures

Returns: The constructed TIMESTAMP

MAKE_TIMESTAMP(year: BIGINT, month: BIGINT, day: BIGINT, hour: BIGINT, minute: BIGINT, second: BIGINT | DECIMAL | DOUBLE) → TIMESTAMP
sql
ParameterTypeRequiredDescription
yearBIGINTYesYear
monthBIGINTYesMonth, 1 to 12
dayBIGINTYesDay of the month
hourBIGINTYesHour, 0 to 23
minuteBIGINTYesMinute, 0 to 59
second`BIGINTDECIMALDOUBLE`

Returns: The constructed TIMESTAMP

MAKE_TIMESTAMP(row: ROW) → TIMESTAMP
sql
ParameterTypeRequiredDescription
rowROWYesNamed fields: year, month, day, hour, minute, second; optional microsecond

Notes

  • MAKE_TIMESTAMP(year, month, day, hour, minute, second) takes the parts as arguments; second may carry a fraction.
  • In the ROW form, required field names are year, month, day, hour, minute, and second (case-insensitive).
  • Optional field microsecond adds sub-second precision when present on the ROW type.
  • The result is a UTC TIMESTAMP. To treat the components as local time in a zone and convert to UTC, use LOCAL_TO_UTC(CAST(… AS TIMESTAMPTZ), 'IANA_or_offset_name').
  • second accepts numeric values; combine microsecond with integer second values when you need explicit microseconds.

Availability

StatusBackends
Not availablemysql

Examples

FeatureQL
RETURN
    -- Construct a TIMESTAMP from six parts
    f1 := MAKE_TIMESTAMP(2024, 3, 15, 14, 30, 45),
    -- Construct a TIMESTAMP without microseconds
    f2 := MAKE_TIMESTAMP(
        ROW(
            2024 AS year,
            3 AS month,
            15 AS day,
            14 AS hour,
            30 AS minute,
            45 AS second
        )
    ),
    -- Local Paris wall time → UTC (CET = UTC+1 in March)
    f3 := LOCAL_TO_UTC(
        MAKE_TIMESTAMP(
            ROW(
                2024 AS year,
                3 AS month,
                15 AS day,
                14 AS hour,
                30 AS minute,
                45 AS second
            )
        )::TIMESTAMPTZ(3),
        'Europe/Paris'
    )
;
Result
f1 TIMESTAMPf2 TIMESTAMPf3 TIMESTAMP
2024-03-15T14:30:452024-03-15T14:30:452024-03-15T13:30:45