> ## 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.

# CONVERT_TIMEZONE

> Converts a timestamp to another time zone or converts a local time between time zones.

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

With valid constant timezone names, NULL timestamp yields NULL. NULL timezone literals yield NULL through the generic branch. Invalid constant timezone names error; the constants may be parsed before NULL timestamp handling.

## Syntax

### Instant (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
convert_timezone(target_timezone, value)
```

### Wallclock (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
convert_timezone(source_timezone, target_timezone, value)
```

## Arguments

### Instant

| Name | Type | Required | Description |
| - | - | - | - |
| target\_timezone | STRING constant | Yes | Target timezone. Valid IANA zone or fixed UTC offset, provided as a scalar literal. Must be a constant argument. |
| value | TIMESTAMP | Yes | Input instant. Use TIMESTAMP with microsecond precision. For the three-argument form, timestamps with negative fractional seconds before the Unix epoch are outside the allowed range. |

### Wallclock

| Name | Type | Required | Description |
| - | - | - | - |
| source\_timezone | STRING constant | Yes | Source wall-clock timezone. Valid IANA zone or fixed UTC offset, provided as a scalar literal. Must be a constant argument. |
| target\_timezone | STRING constant | Yes | Target wall-clock timezone. Valid IANA zone or fixed UTC offset, provided as a scalar literal. Must be a constant argument. |
| value | TIMESTAMP | Yes | Source wall-clock timestamp. Use TIMESTAMP with microsecond precision. For the three-argument form, timestamps with negative fractional seconds before the Unix epoch are outside the allowed range. |

## Returns

* Type: TIMESTAMP: timezone-bearing for two arguments, timezone-free for three arguments.
* NULL behavior: With valid constant timezone names, NULL timestamp yields NULL. NULL timezone literals yield NULL through the generic branch. Invalid constant timezone names error; the constants may be parsed before NULL timestamp handling.

## Properties

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

## Usage notes

* The two-argument form sets the target time zone while preserving the same instant.
* The three-argument form converts a local time from the source time zone to the target time zone and returns a TIMESTAMP without a time zone.
* In the three-argument form, a local time that occurs twice during a clock change selects the earlier instant. A local time skipped by a clock change uses the offset after the change.
* With two arguments, the instant stays the same and the result uses the target time zone. With three arguments, the source local time is converted to the target local time and returned without a time zone. Time-zone arguments must be constant.
* In the three-argument form, a local time repeated by a clock change selects the earlier instant. For a skipped local time, conversion tries the offset one hour later and raises an error if the time still cannot be resolved.

## Examples

### Convert fixed source wall clock

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT convert_timezone('Asia/Kolkata','UTC',TIMESTAMP '2024-01-01 05:30:00') AS result;
```

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

### A time-zone change can change the date

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT convert_timezone('UTC', 'Asia/Kolkata', TIMESTAMP '2024-01-01 20:00:00') AS local_time;
```

| local\_time |
| - |
| 2024-01-02 01:30:00 |

## Limitations

* Three-argument conversion reconstructs negative fractional epochs using division toward zero and an absolute remainder; that input extension is excluded.
* Use a constant target time zone. A time-zone column can change both the displayed clock time and the result’s time-zone information, so it is outside these forms.


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