Skip to main content

make_timestamp_ntz function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Creates a timestamp without a time zone from date and time fields.

Syntax​

make_timestamp_ntz(year, month, day, hour, min, sec)

make_timestamp_ntz(date, time)
Beta

The time argument uses the TIME data type, which is in Beta.

Arguments​

  • year: An INTEGER expression from 1 through 9999.
  • month: An INTEGER expression from 1 (January) through 12 (December).
  • day: An INTEGER expression from 1 through 31.
  • hour: An INTEGER expression from 0 through 23.
  • min: An INTEGER expression from 0 through 59.
  • sec: A numeric expression from 0 through 60.
  • date: A DATE expression that provides the year, month, and day fields.
  • time: A TIME expression that provides the hour, minute, and second fields.

Returns​

A TIMESTAMP_NTZ.

If sec is 60, the function interprets it as 0 and adds one minute to the result.

If an argument is out of bounds, the function raises DATETIME_FIELD_OUT_OF_BOUNDS. Use try_make_timestamp_ntz to return NULL instead.

Common error conditions​

Examples​

SQL
> SELECT make_timestamp_ntz(2014, 12, 28, 6, 30, 45.887);
2014-12-28 06:30:45.887

> SELECT make_timestamp_ntz(DATE'2014-12-28', TIME'06:30:45.887');
2014-12-28 06:30:45.887