---
schema_version: "1"
id: 96eda8105b1798b9316dd41cb1f029d010534d0aaf1b9ebd62a94e3e6cf97255
title: Convert a Field to a Date Field
collection: tableau
version: current
locale: en-us
portal_url: https://docs.salesforce.com/tableau/current/en-us/public/desktop/data_dateparse.md
canonical_url: https://help.tableau.com/current/public/desktop/en-us/data_dateparse.htm
source_site: help.tableau.com
content_type: documentation
content_hash: c4e4644444482cac99ee9c2d74df66b3ed2e2fedba2512bebbbc5e2fab218864
description: Convert a text or numeric field to a date using data type changes and the DATEPARSE function.
---
[Skip to main content](#main-content)

# Convert a Field to a Date Field

Each database stores Date fields in slightly different ways. Tableau does its best in interpreting the date fields, but sometimes a field will be imported to Tableau as a text string or numerical field. If this happens, there are a few steps we can take to resolve the issue.

> [!TIP]
> 
>  The following information is about changing the data type of a field to a date. To format an existing date field and control how it appears in a viz, see [Custom Date Formats](https://help.tableau.com/current/pro/desktop/en-us/dates_custom_date_formats.htm).

## Verifying Date Fields

A date field might appear as a string, with an Abc data type icon ![Text or string values.](/tableau/current/en-us/public/desktop/en-us/Img/symbol_text_row.png).

When dates are interpreted as strings, you will lose all of the features and conveniences of working with date fields, such as drilling down, using date calculations, and switching between Continuous and Discrete measures.

If your dates aren't interpreted correctly, take the following steps in order:

1. [Change the data type of the field](#type)
2. [Create a calculation using the DATEPARSE function](#dateparse)
3. [Create a calculation using the DATE function](#date)

## Change the data type of the field

The first step in resolving a date field interpretation issue is to make sure the data type is set to Date or Date & Time.

1. In the Data Source or Data pane, click the data type icon for the date field and change the data type to Date or Date & Time
    
    ![A dropdown menu displays the data types for a field, with the date and time option highlighted.](/tableau/current/en-us/public/desktop/en-us/Img/dateparse_type.png)
2. Inspect the data in the view or Data Source pane. If you see many Null values, return the data type to String and proceed to [Create a calculation using the DATEPARSE function](#dateparse) to correct the issue.
    
    ![Null Values showing in the Data Source screen.](/tableau/current/en-us/public/desktop/en-us/Img/dateparse_example_3.png "Null values are present.")

## Create a calculation using the DATEPARSE function

Dates are stored in a nearly infinite array of formats. Some date fields have years before months, others separate the parts of the date with periods, and still others use a combination of formats. When Tableau cannot interpret a date field, it might be because the particular format cannot be translated.

The DATEPARSE function lets you clearly define which parts of your field are which parts of a date. In essence, you are creating a map that Tableau can use to translate the string into a date field. This map is referred to as the format.

**Note:** This function is available through the following connectors: non-legacy Excel and text file connections, Amazon EMR Hadoop Hive, Cloudera Hadoop, Google Sheets, Hortonworks Hadoop Hive, MapR Hadoop Hive, MySQL, Oracle, PostgreSQL, and Tableau extracts. Some formats may not be available for all connections.  
  
DATEPARSE isn't supported on Hive variants. Only Denodo, Drill, and snowflake are supported.

### Creating the DATEPARSE calculation

1. Inspect the current format of your date field. Note where months, years, hours, and days are displayed in your field. You will need this information for the DATEPARSE function.
    
    <table style="width: 100%;">
                            <colgroup><col>
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>
                                        <img src="https://help.tableau.com/current/public/desktop/en-us/Img/dateparse_example4.png" alt="Date parse formula with portions of the formula labeled A, B, C, and D.">
                                    </td>
                                    <td>
                                        <p><span class="uicontrol">A</span>. Day of month</p>
                                        <p><span class="uicontrol">B</span>. Month</p>
                                        <p><span class="uicontrol">C</span>. Year</p>
                                        <p><span class="uicontrol">D</span>. Hour, minute, second, millisecond, period</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
2. Right click your date field in the Dimensions pane and select Create \> Calculated Field.
3. In the dialog, write the DATEPARSE function. The DATEPARSE function has two parts: the format and the string. The string is field you wish to convert, which must be a string data type ![Text or string values.](/tableau/current/en-us/public/desktop/en-us/Img/symbol_text_row.png).
    
    <table class="table--plain" style="width: 100%;">
                            <colgroup><col style="width: 569px;">
                            <col>
                            </colgroup><tbody>
                                <tr>
                                    <td>
                                        <img src="https://help.tableau.com/current/public/desktop/en-us/Img/dateparse_example_5.png" alt="Data parse formula with portions of the formula labeled A and B.">
                                    </td>
                                    <td>
                                        <p><span class="uicontrol">A</span>. Format</p>
                                        <p><span class="uicontrol">B</span>. String</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
    
    The format is the guide Tableau will use to interpret the string as a date. Each part of a date or time string has a matching symbol, as seen in the table below. The format must exactly duplicate the way that the date is displayed. For example, if a single year code ("Y") is used when the string has a 2-digit year code ("26"), the calculation might return null values.
    
    Note: The exception to the format exactly duplicating the displayed string is that long form parts of dates ("September") can be formatted with four symbols ("September" = "MMMM").
    
    The format must include all spaces, hyphens, and other non-alphanumeric symbols in order to interpret the string correctly.
    
    ### Date Field Symbols
    
    <table class="table-plain">
                            <colgroup><col class="Column-Column1">
                            <col class="Column-Column1">
                            <col class="Column-Column1">
                            </colgroup><tbody>
                                <tr class="Body-Body1">
                                    <th class="BodyE-Column1-Body1" style="font-weight: bold;">Date Part</th>
                                    <th class="BodyE-Column1-Body1" style="font-weight: bold;">Symbol</th>
                                    <th class="BodyE-Column1-Body1" style="font-weight: bold;">Example Output</th>
                                </tr>
                                <tr class="Body-Body2">
                                    <td class="BodyE-Column1-Body2">Year</td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>yy</p>
                                        <p>y, yyyy</p>
                                        <p>Y</p>
                                    </td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>26</p>
                                        <p>2026</p>
                                        <p>2026 (used for Week of Year based calendars)</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body1">
                                    <td class="BodyE-Column1-Body1">Quarter of year</td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>Q</p>
                                        <p>QQ</p>
                                        <p>QQQ</p>
                                        <p>QQQQ</p>
                                    </td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>2</p>
                                        <p>02</p>
                                        <p>Q2</p>
                                        <p>2nd quarter</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body1">
                                    <td class="BodyE-Column1-Body1">Month</td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>M</p>
                                        <p>MM</p>
                                        <p>MMM</p>
                                        <p>MMMM</p>
                                    </td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>9</p>
                                        <p>09</p>
                                        <p>Sep</p>
                                        <p>September</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body2">
                                    <td class="BodyE-Column1-Body2">Week of year </td>
                                    <td class="BodyE-Column1-Body2">w, ww</td>
                                    <td class="BodyE-Column1-Body2">47 </td>
                                </tr>
                                <tr class="Body-Body2">
                                    <td class="BodyE-Column1-Body2">Day of week</td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>E, EE, EEE</p>
                                        <p>EEEE</p>
                                        <p>EEEEE</p>
                                    </td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>Mon</p>
                                        <p>Monday</p>
                                        <p>M</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body1">
                                    <td class="BodyE-Column1-Body1">Day of month</td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>d</p>
                                        <p>dd</p>
                                    </td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>1, 15</p>
                                        <p>01, 15</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body2">
                                    <td class="BodyE-Column1-Body2">Day of year (1-365)</td>
                                    <td class="BodyE-Column1-Body2">D</td>
                                    <td class="BodyE-Column1-Body2">23, 143</td>
                                </tr>
                                <tr class="Body-Body2">
                                    <td class="BodyE-Column1-Body2">
                                        <p>Hour (1-12)</p>
                                    </td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>h</p>
                                        <p>hh</p>
                                    </td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>8</p>
                                        <p>08</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body2">
                                    <td class="BodyE-Column1-Body2">Hour (0-23)</td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>H</p>
                                        <p>HH</p>
                                    </td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>8</p>
                                        <p>08</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body1">
                                    <td class="BodyE-Column1-Body1">Minute</td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>m</p>
                                        <p>mm</p>
                                    </td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>8</p>
                                        <p>08</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body2">
                                    <td class="BodyE-Column1-Body2">Second in a minute</td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>s</p>
                                        <p>ss</p>
                                    </td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>5</p>
                                        <p>05</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body1">
                                    <td class="BodyE-Column1-Body1">Fractional second</td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>S</p>
                                        <p>SS</p>
                                        <p>SSS</p>
                                        <p>SSSS</p>
                                    </td>
                                    <td class="BodyE-Column1-Body1">
                                        <p>2</p>
                                        <p>23</p>
                                        <p>235</p>
                                        <p>2350</p>
                                    </td>
                                </tr>
                                <tr class="Body-Body2">
                                    <td class="BodyB-Column1-Body2">Milliseconds in day</td>
                                    <td class="BodyB-Column1-Body2">A</td>
                                    <td class="BodyB-Column1-Body2">34532</td>
                                </tr>
                                <tr class="Body-Body1">
                                    <td class="BodyE-Column1-Body1">Period (am/pm marker)</td>
                                    <td class="BodyE-Column1-Body1">a, aa, aaa</td>
                                    <td class="BodyE-Column1-Body1">AM, am, PM</td>
                                </tr>
                                <tr class="Body-Body2">
                                    <td class="BodyE-Column1-Body2">Time Zone</td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>z, zz, zzz</p>
                                        <p>zzzz</p>
                                        <p>Z, ZZ, ZZZ</p>
                                        <p>ZZZZ</p>
                                    </td>
                                    <td class="BodyE-Column1-Body2">
                                        <p>PDT</p>
                                        <p>Pacific Daylight Time</p>
                                        <p>-0800</p>
                                        <p>PST-08:00</p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
    
    For a more complete list of date symbols, please see the [Formatting Date and Times Overview on the International Components](https://unicode-org.github.io/icu/userguide/format_parse/datetime/) for Unicode page.
    
    **Note:** Some date formats are not supported by all databases and file types.
4. Check your format against the string displayed in Tableau. If the symbols and formatting is correct, select OK to create the new calculated field. The calculated field will act as a date field in your view.
    
    ![A diagram of the DATEPARSE function.](/tableau/current/en-us/public/desktop/en-us/Img/dateparse_example_6.png "Compare format to string.")

### Hyper extracts

For .hyper extract data sources, the symbols are defined by the Unicode Consortium. For more information, go to [Format syntax in DATEPARSE function for extract data sources](https://help.tableau.com/current/public/desktop/en-us/dates_custom_date_formats.htm#dateparse) to see a the subset of field types and symbols that can be used with the DATEPARSE function in .hyper extracts.

### Locale considerations

The DATEPARSE function relies on the locale specified by your computer settings to interpret and then display the strings that you want to convert. More specifically, the locale will affect whether a certain format can be recognized. This means that if a format is not supported by the locale, then you might see a null value or no value returned. For example, suppose you have the following string in your data:

`12Sep2026:9:8:8.6546`

The values returned from the DATEPARSE function for this string are different based on locale. In the English locale you will get a certain value, but for the Japanese locale you will get no value. In this case, no value is returned because the Japanese locale does not recognize "Sep".

**Datetime value**

 
| English locale | Japanese locale |
| --- | --- |
| #9/12/2026 9:08:09 AM# | \- |

As with all dates, after you have used the DATEPARSE function to convert a string to a datetime type, by default Tableau will display the datetime value in the default format of your locale. If the locale changes, the result of the DATEPARSE function might display your new datetime value in a different format.

## Create a calculation using the DATE function

If the DATEPARSE function is not available for the data that you're working with, or the field you are trying to convert is a number data type, you can use the DATE function instead.

The DATE function converts a number, string or date expression to a date type. When you create a calculation that uses the DATE function, Tableau creates a new field in your Tableau data source that allows you to interact with your date data as a date. To successfully produce date values from a number, string, or date expression using the DATE function, Tableau needs to be able to interpret the components of the string into date parts. After the components of the date are identified, Tableau uses the computer locale to determine the default format of the date.

For example, suppose the table you're working with contains a column of date data that is called "Original Date." The "Original Date" column is a string type.

- **Original Date**: 03Jan2026, 05Jan2026, 07Mar2026, 19Mar2026, 30Apr2026

In this case, you can create a calculated field called "New Date" that uses an expression in a DATE function to convert the string values in the "Original Date" field into date values.

`DATE (LEFT([Original Date], 2) + "/" + MID([Original Date],3,3) + "/" + RIGHT([Original Date],4))`

For this example, the date expression is comprised of the LEFT function to isolate the day component, the MID function to isolate the month component, and the RIGHT function to isolate the year component.

The "New Date" calculation produces the following column:

- **New Date**: 1/3/2026, 1/5/2026, 3/7/2026, 3/19/2026, 4/30/2026

In this example, the new date values are based on an English locale and default formatting.

## See Also

[Custom Date Formats](https://help.tableau.com/current/public/desktop/en-us/dates_custom_date_formats.htm)

[Format Dates Using ISO-8601 Weeks and Years](https://help.tableau.com/current/public/desktop/en-us/dates_custom_date_formats_week.htm)

[Date Functions](https://help.tableau.com/current/public/desktop/en-us/functions_functions_date.htm)

[All Functions (by Category): Date](https://help.tableau.com/current/public/desktop/en-us/functions_all_categories.htm#Date)

[STR() Function Ignores the Default Date and Number Formatting](http://kb.tableau.com/articles/Issue/str-function-ignores-date-and-number-formatting) (Tableau Knowledge Base)