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
| Parameter | Type | Required | Description |
|---|---|---|---|
year | BIGINT | Yes | Year |
month | BIGINT | Yes | Month, 1 to 12 |
day | BIGINT | Yes | Day of the month |
hour | BIGINT | Yes | Hour, 0 to 23 |
minute | BIGINT | Yes | Minute, 0 to 59 |
second | `BIGINT | DECIMAL | DOUBLE` |
Returns: The constructed TIMESTAMP
MAKE_TIMESTAMP(row: ROW) → TIMESTAMP sql
| Parameter | Type | Required | Description |
|---|---|---|---|
row | ROW | Yes | Named fields: year, month, day, hour, minute, second; optional microsecond |
Notes
MAKE_TIMESTAMP(year, month, day, hour, minute, second)takes the parts as arguments;secondmay 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
| Status | Backends |
|---|---|
| Not available | mysql |
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 TIMESTAMP | f2 TIMESTAMP | f3 TIMESTAMP |
|---|---|---|
| 2024-03-15T14:30:45 | 2024-03-15T14:30:45 | 2024-03-15T13:30:45 |
On this page