---
title: make_timestamp function
description: Learn the syntax of the make\_timestamp function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp
---

# `make_timestamp` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Creates a timestamp from `year`, `month`, `day`, `hour`, `min`, `sec`, and `timezone` fields.

## Syntax

```
make_timestamp(year, month, day, hour, min, sec [, timezone] )

make_timestamp(date [, time [, timezone]] )
```

> [!NOTE]
> **Beta**
>
> The `time` argument uses the [`TIME`](https://docs.databricks.com/aws/en/sql/language-manual/data-types/time-type.md) data type, which is in Beta.

## Arguments

* `year`: An `INTEGER` expression evaluating to a value from 1 to 9999.
* `month`: An `INTEGER` expression evaluating to a value from 1 (January) to 12 (December).
* `day`: An `INTEGER` expression evaluating to a value from 1 to 31.
* `hour`: An `INTEGER` expression evaluating to a value between 0 and 23.
* `min`: An `INTEGER` expression evaluating to a value between 0 and 59.
* `sec`: A numeric expression evaluating to a value between 0 and 60.
* `date`: A [`DATE`](https://docs.databricks.com/aws/en/sql/language-manual/data-types/date-type.md) expression providing the year, month, and day fields.
* `time`: An optional [`TIME`](https://docs.databricks.com/aws/en/sql/language-manual/data-types/time-type.md) expression providing the hour, minute, and second fields. Defaults to `00:00:00` if omitted.
* `timezone`: An optional `STRING` expression evaluating to a valid time zone, such as `CET` or `UTC`.

## Returns

A `TIMESTAMP`.

If an argument is out of bounds, the function raises [DATETIME\_FIELD\_OUT\_OF\_BOUNDS](https://docs.databricks.com/aws/en/error-messages/datetime-field-out-of-bounds-error-class.md). Use [try\_make\_timestamp](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_make_timestamp.md) to return `NULL` instead.

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

If `sec` has a fractional value that cannot be represented in microsecond precision, Databricks raises [INVALID\_FRACTION\_OF\_SECOND](https://docs.databricks.com/aws/en/error-messages/error-classes.md#invalid_fraction_of_second).

## Common error conditions

* [DATETIME\_FIELD\_OUT\_OF\_BOUNDS](https://docs.databricks.com/aws/en/error-messages/datetime-field-out-of-bounds-error-class.md)
* [INVALID\_FRACTION\_OF\_SECOND](https://docs.databricks.com/aws/en/error-messages/error-classes.md#invalid_fraction_of_second)

## Examples

```sql
> SELECT make_timestamp(2014, 12, 28, 6, 30, 45.887);
 2014-12-28 06:30:45.887
> SELECT make_timestamp(2014, 12, 28, 6, 30, 45.887, 'CET');
 2014-12-27 21:30:45.887
> SELECT make_timestamp(2019, 6, 30, 23, 59, 60);
 2019-07-01 00:00:00
> SELECT make_timestamp(NULL, 7, 22, 15, 30, 0);
 NULL

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

> SELECT make_timestamp(DATE'2014-12-28', TIME'06:30:45.887', 'CET');
 2014-12-27 21:30:45.887

> SELECT make_timestamp(DATE'2014-12-28');
 2014-12-28 00:00:00

> SELECT make_timestamp(2024, 13, 1, 0, 0, 0);
  Error: DATETIME_FIELD_OUT_OF_BOUNDS
```

## Related functions

* [`make_date` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_date.md)
* [`make_timestamp_ltz` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp_ltz.md)
* [`make_timestamp_ntz` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp_ntz.md)
* [`try_make_timestamp` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_make_timestamp.md)
