> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TIMESTAMP

> Constructs a UTC timestamp from string, date or timestamp input.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

NULL value yields NULL. NULL timezone uses default interpretation. Invalid text/timezones and nonexistent local times raise errors.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
timestamp(value [, timezone])
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING, DATE or TIMESTAMP | Yes | Value to construct an instant from. DATE, STRING calendar text or TIMESTAMP with microsecond precision; ordinary representable calendar range. The optional timezone is a scalar STRING. |
| timezone | STRING constant | No | Optional interpretation timezone. Must be a constant argument. Default: UTC; NULL timezone uses default interpretation. |

## Returns

* Type: TIMESTAMP with UTC timezone
* NULL behavior: NULL value yields NULL. NULL timezone uses default interpretation. Invalid text/timezones and nonexistent local times raise errors.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Exact result | Yes |

## Usage notes

* DATE input means midnight, optionally interpreted in the supplied timezone, then converted to UTC.
* If midnight occurs twice because of a local clock change, DATE input selects the earlier instant.
* Without an explicit time zone, TIMESTAMP input keeps the same instant and the result uses UTC. With a time zone, the input’s UTC clock values are interpreted as local time in that zone; the input’s original time-zone label does not control this interpretation.
* DATE input with a time zone means midnight in that zone, converted to UTC. For TIMESTAMP input, a local time repeated by a clock change selects the earlier instant; a skipped local time raises an error.

## Examples

### Basic example

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT timestamp(DATE '2024-01-01','UTC') AS result;
```

| result |
| - |
| 2024-01-01 00:00:00 UTC |

### Convert a date at midnight

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT timestamp(DATE '2024-02-29', 'UTC') AS leap_day;
```

| leap\_day |
| - |
| 2024-02-29 00:00:00 UTC |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.