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

> Converts a date representation, returning NULL on parse failure.

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

Bad input or NULL format yields NULL. A nonconstant format raises an error. NULL temporal input yields NULL.

## Syntax

### Scalar

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

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING, DATE or TIMESTAMP | Yes | Value to parse. |
| format | STRING constant | No | Optional explicit format. Must be a constant argument. Default: Automatic parsing. |

## Returns

* Type: DATE
* NULL behavior: Bad input or NULL format yields NULL. A nonconstant format raises an error. NULL temporal input yields NULL.

## Properties

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

## Examples

### Basic example 1

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT try_to_date('not a date') AS result;
```

| result |
| - |
| NULL |

### Basic example 2

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT try_to_date('2024-03-15') AS result;
```

| result |
| - |
| 2024-03-15 |

## Limitations

* Input types without a supported date conversion return NULL. Numeric input is not interpreted as a year.


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