---
schema_version: "1"
id: 19883faaca6dced04a89807c7580828094ac4c5b379adcf985f3b037adbb96e1
title: TO_DATE
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/formatting-func/to-date.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/to-date.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ff19a4bb3d28ee53ca685bdf381fa64cd1e2ef11f00d578f45c3fe19c0e2aa44
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `TO_DATE`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Converts a string to a `date` value by interpreting it according to the specified format pattern.

## Syntax

```sql
to_date(<text>, <format_pattern>)
```

## Arguments

### Required

-   `<text>`: The string to convert to a date.
-   `<format_pattern>`: A text pattern that describes the format of `<text>`. For supported pattern characters and modifiers, see [TO_CHAR](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/to-char.md).

## Returns

Returns a `date` value.

Returns NULL if either argument is NULL.

## Considerations

-   `TO_DATE` converts source strings in formats that a direct cast can't handle. For most standard date formats, cast the string directly to `date` instead.
-   Template characters in the pattern that don't match a date field are skipped in the input string. For example, literal separators such as `-` or `/` in the format pattern skip the corresponding characters in the input.
-   `YYYY` can't process a year with more than four digits. Use a non-digit separator after the year for five-or-more digit years — for example, `to_date('20000-11-30', 'YYYY-MM-DD')`.

## Examples

### Parse a Date from a Long-Form String

Convert a written-out date string to a `date` value.

```sql
SELECT to_date('05 Dec 2000', 'DD Mon YYYY');
```

Returns `2000-12-05`.

### Parse a Date with Numeric Separators

Convert a slash-delimited date string.

```sql
SELECT to_date('12/31/2024', 'MM/DD/YYYY');
```

Returns `2024-12-31`.

## Related Documentation

-   [TO_CHAR](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/to-char.md)
-   [TO_TIMESTAMP](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/to-timestamp.md)
-   [Data Type Formatting Functions](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/formatting-func.md)
