# TIMEZONE and AT TIME ZONE functions
Converts timestamp to a different time zone.

> For the complete documentation index, see [llms.txt](https://preview.materialize.com/materialize/40269/llms.txt).


`TIMEZONE` and `AT TIME ZONE` convert a [`timestamp`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md#timestamp-info) or a [`timestamptz`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md#timestamp-with-time-zone-info) to a different time zone.

**Known limitation:** You must explicitly cast the type for the time zone.

## Signatures



```mzsql
TIMEZONE ( <zone>::<type>, <timestamp> | <timestamptz> )

```

| Syntax element | Description |
| --- | --- |
| `<zone>` | A [`text`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/text/index.md) value specifying the target time zone.  |
| `<type>` | A [`text`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/text/index.md) or [`numeric`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/numeric/index.md) type specifying the datatype in which the time zone is expressed. **Known limitation:** You must explicitly cast the type for the time zone.  |
| `<timestamp>` | A [`timestamp`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md) value (timestamp without time zone).  |
| `<timestamptz>` | A [`timestamptz`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md) value (timestamp with time zone).  |




```mzsql
<timestamp> | <timestamptz> AT TIME ZONE <zone>::<type>

```

| Syntax element | Description |
| --- | --- |
| `<timestamp>` | A [`timestamp`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md) value (timestamp without time zone).  |
| `<timestamptz>` | A [`timestamptz`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md) value (timestamp with time zone).  |
| **AT TIME ZONE** `<zone>::<type>` | The target time zone. `<zone>` is a [`text`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/text/index.md) value. `<type>` is a [`text`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/text/index.md) or [`numeric`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/numeric/index.md) type. **Known limitation:** You must explicitly cast the type for the time zone.  |


Parameter | Type | Description
----------|------|------------
_zone_ | [`text`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/text/index.md) | The target time zone.
_type_  |[`text`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/text/index.md) or [`numeric`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/numeric/index.md) |  The datatype in which the time zone is expressed
_timestamp_ | [`timestamp`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md#timestamp-info) | The timestamp without time zone.  |   |
_timestamptz_ | [`timestamptz`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md#timestamp-with-time-zone-info) | The timestamp with time zone.

## Return values

`TIMEZONE` and  `AT TIME ZONE` return [`timestamp`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md#timestamp-info) if the input is [`timestamptz`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md#timestamp-with-time-zone-info), and [`timestamptz`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md#timestamp-with-time-zone-info) if the input is [`timestamp`](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md#timestamp-info).

**Note:** `timestamp` and `timestamptz` always store data in UTC, even if the date is returned as the local time.

## Examples

### Convert timestamp to another time zone, returned as UTC with offset

```mzsql
SELECT TIMESTAMP '2020-12-21 18:53:49' AT TIME ZONE 'America/New_York'::text;
```
```
        timezone
------------------------
2020-12-21 23:53:49+00
(1 row)
```

```mzsql
SELECT TIMEZONE('America/New_York'::text,'2020-12-21 18:53:49');
```
```
        timezone
------------------------
2020-12-21 23:53:49+00
(1 row)
```

### Convert timestamp to another time zone, returned as specified local time

```mzsql
SELECT TIMESTAMPTZ '2020-12-21 18:53:49+08' AT TIME ZONE 'America/New_York'::text;
```
```
        timezone
------------------------
2020-12-21 05:53:49
(1 row)
```

```mzsql
SELECT TIMEZONE ('America/New_York'::text,'2020-12-21 18:53:49+08');
```
```
        timezone
------------------------
2020-12-21 05:53:49
(1 row)
```

## Related topics
* [`timestamp` and `timestamp with time zone` data types](https://preview.materialize.com/materialize/40269/markdown-docs/sql/types/timestamp/index.md)
