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

# TRY_TO_TIMESTAMP

> Parses a value as a timestamp without a timezone, returning NULL on a failed supported conversion.

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

NULL or unparseable input returns NULL in the single-value parsing form. A NULL format or invalid argument can raise an error. The numeric-scale form requires the constant, non-NULL arguments described above.

## Syntax

### Scalar

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

### Formatted (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
try_to_timestamp(text,format)
```

* NULL explicit format raises an error; TRY does not suppress this argument error.

### Scaled (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
try_to_timestamp(numeric_value,scale)
```

* Use integer epoch values and a constant BIGINT scale; floating-point and decimal operands can select string-format handling instead of epoch scaling.
* Integer division by 10^scale discards the subsecond remainder.
* Both arguments must be constants. Numeric columns can raise an argument error, including with TRY variants.

## Arguments

### Scalar

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE or DECIMAL(p, s), DATE or TIMESTAMP | Yes | Value to parse. For DECIMAL(p, s), p is precision (total digits) and s is scale (digits after the decimal point). |

### Formatted

| Name | Type | Required | Description |
| - | - | - | - |
| text | STRING | Yes | Text to parse. |
| format | STRING | Yes | Pattern used to parse the input. |

### Scaled

| Name | Type | Required | Description |
| - | - | - | - |
| numeric\_value | TINYINT, SMALLINT, INTEGER or BIGINT | Yes | Scaled integer epoch value. Epoch units before division by 10^scale. Explicitly CAST floating-point and decimal values to BIGINT before this call. Must be a constant argument. |
| scale | BIGINT | Yes | Base-10 epoch scale. A non-NULL constant from 0 through 18; use an explicit CAST to BIGINT. Must be a constant argument. |

## Returns

* Type: TIMESTAMP (microsecond precision, no timezone)
* NULL behavior: NULL or unparseable input returns NULL in the single-value parsing form. A NULL format or invalid argument can raise an error. The numeric-scale form requires the constant, non-NULL arguments described above.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Partial (The result is limited to microsecond precision; parsing can discard a timezone offset.) |

## Usage notes

* These forms use the non-ANSI parsing rules of TO\_TIMESTAMP\_NTZ.
* A trailing timezone offset is removed to preserve wall-clock time instead of normalizing to UTC.
* The two-numeric-argument form divides by 10^scale before converting whole seconds to microseconds; subsecond remainders are currently discarded.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.
* Deterministic: The same inputs and settings produce the same result.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT try_to_timestamp('not_a_date') AS invalid_value;
```

| invalid\_value |
| - |
| NULL |

### Valid text and invalid text

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT try_to_timestamp('2024-02-29 12:30:00') AS valid_time, try_to_timestamp('not-a-timestamp') AS invalid_time;
```

| valid\_time | invalid\_time |
| - | - |
| 2024-02-29 12:30:00 | NULL |

## Limitations

* Format handling and numeric epoch-unit inference follow TO\_TIMESTAMP\_NTZ; unsupported combinations can fail during planning.
* The scaled form requires the constant integer arguments described above. Cast FLOAT, DOUBLE, or DECIMAL values to BIGINT explicitly before using them as epoch units.

## Related functions

* [to\_timestamp\_ntz](/query/sql/functions/date-time/to_timestamp_ntz)
* [try\_cast](/query/sql/functions/conditional/try_cast)


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