You are here:
Use the DATEPARSE Function
The DATEPARSE function takes that string input and the user-specified format and returns a date field.
Dates are stored in strings in various patterns (for example,
YYYY-MM-DD, DDMMMMYY, and MMM DD, YYYY).
When these fields are treated as strings, they lack the functionality of a field with a
Date data type, such as date hierarchy drill-down, continuous dates, and
manipulation of date parts.
If changing the data type from string to date doesn't work,
use the DATEPARSE function to convert the field into a date data type. The
syntax is DATEPARSE("format", string).
- The format value is a hard-coded string based on the supported formats.
- The string value can be a field or a hard-coded value.
The format must be given to avoid mistakes such as reversing the month and day across different locales, such as:
DATEPARSE("MMDDYYYY", "03112028") outputs
March 11, 2026.
DATEPARSE("DDMMYYYY", "03112028") outputs November 3,
2026.
The DATEPARSE function supports the formats mentioned in this table:
| Unit of Time | Format | Sample Output |
|---|---|---|
| Year | yy y, yyyy |
26 2026 |
| Quarter | Q/q QQ/qq |
2 02 |
| Month | M MM MMM MMMM |
9 09 Sep September |
| Standalone Month | L LL LLL LLLL |
9 09 Sep September |
| Week of the Year (1–53) | w ww |
1 47 |
| Day of the Month | d dd |
|
| Day of the Year | D DD DDD |
3 25 143 |
| Local day of week (depends on locale) | e ee eee eeee |
1 01 Sun or Mon Sunday or Monday |
| Day of Week | E EE EEE EEEE |
Wed Wednesday |
Hour (12h) (1-12) |
h uh |
8 08 |
Hour (24h) (0-23) |
H HH |
8 15 |
| Minute | m mm |
8 08 |
| Second | s ss |
8 08 |
| Fractional Second | S SS SSS (up to six decimal places) |
2 23 235 (up to six decimal places) |
| ISO Year | d dd |
ISO Year |
| ISO Week | IW |
ISO Week |
Notes for Using the Formats
Inputs
- The format input must be hard-coded text within the function.
- Invalid inputs cause query failures rather than null output.
- Quarter inputs must be 1–4 or 01–04.
- Fractional seconds are supported up to six decimal places.
- Time zones are ignored.
-
Local day of week
erespects locale and what day of the week is considered as the start of the week, such as Sunday or Monday.
Year Behavior
yyreturns the two-digit year. For two-digit years under 70, the century is the 2000s, or 2000+yy. For two-digit years 70 and higher, the century is the 1900s, or 1900+yy.-
For standalone months (without a year specification) the default year is 0001. This format differs from Tableau Classic, which defaults to 1900.
ISO Formats
- Avoid mixing ISO and non-ISO date parts, and avoid mixing ISO patterns. For example, use
IYYY IWorYYYY ww, notIYYY wworYYYY IW. - Formats specifying ISO Year must also specify ISO Week. Without ISO Week, the Gregorian year is returned. This format differs from Tableau Classic, which returns the ISO year even without the week.
Unsupported formats that are available in Tableau Classic:
- A—milliseconds in a day aren't supported. Instead of dropping or
rounding the time,
Areturns 00:00:00. - c—standalone day of week. Using
ccauses errors and a query failure. - EEEEE/EEEEEE—short weekdays (such as T or Tu) cause errors and a
query failure, only up to
EEEEis supported. - Y/YYY—variations in ISO year formats aren't supported. Using
YorYYYcauses errors and a query failure.
Examples
MM/dd/yyyy HH:mm:ss → 09/22/2018
13:05:00
ddMMMMYY → 20February2021
2016-06-04T1430 → YYYY-MM-dd'T'Hmm

