How to Convert String to Date in Tableau

Cody Schneider••8 min read

When you import data into Tableau, you expect your dates to behave like dates. But sometimes they show up as simple text strings, which stops you from building time-based visualizations, calculating trends, or filtering by month or quarter. This guide walks you through the easiest ways to convert those text strings into proper Tableau dates, from a simple click to powerful custom calculations.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Why Does Tableau Read My Dates as Text?

Tableau is smart, but it can get tripped up if the date format is inconsistent or non-standard. When you see the "Abc" icon next to your date field instead of a calendar icon in the Data pane, it means Tableau has classified it as a string dimension. This usually happens for a few common reasons:

  • Mixed-Up Formats: Your data source might contain a mix of formats in the same column, such as "01/25/2024," "Jan 25, 2024," and "2024-01-25." Faced with this inconsistency, Tableau plays it safe and treats the entire column as text.
  • Unusual Separators: While Tableau recognizes common date separators like forward slashes (/) and dashes (-), it may falter with periods (.), spaces, or other characters. A date like "01.25.2024" is a frequent culprit.
  • Extra Characters or Spaces: Unwanted characters or even leading/trailing spaces can cause problems. For example, a hidden space at the end of "January 25, 2024 " could prevent Tableau from correctly identifying the format.
  • Text Includes Names for Ordinal Numbers (st, nd, rd, th): Formats like "25th of January, 2024" contain text that standard date interpreters don't understand and will therefore get flagged as a string.

Once you’ve identified your date field is actually a string field, you have two primary methods to fix it: the one-click fix and a more robust solution using calculated fields.

The Quick Fix: Change Data Type

For simple, standardized text strings, Tableau often has a built-in solution that takes just two clicks. This is the first thing you should always try because it’s so easy. It works best when your text dates are in a consistent, unambiguous format like MM/DD/YYYY or YYYY-MM-DD.

Here’s how to do it in the worksheet:

  1. Navigate to the "Data" pane on the left side of your worksheet.
  2. Locate the field you want to convert (the one with the "Abc" icon).
  3. Click the "Abc" icon next to the field name.
  4. A dropdown menu will appear. Select either Date or Date & Time from the list.

If Tableau successfully recognizes the format, the icon will change to a calendar, and your field is now ready for time-series analysis. If it fails, you might see many Null values in your data view, which means Tableau couldn't understand the format. When that happens, it's time to take more control with a calculated field.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

The Power-User Method: Calculated Fields For The Win

When the simple "Change Data Type" trick fails, calculated fields give you complete control to tell Tableau exactly how to interpret a string as a date. They let you handle almost any weird format you encounter. There are two primary functions you'll use: DATEPARSE() and DATE().

Using the DATEPARSE Function

The DATEPARSE function is your go-to tool for non-standard string formats. It works by taking two inputs: a "format mask" that describes what your date string looks like, and the name of the string field you want to convert. The syntax is:

DATEPARSE(format, string_date_field)

Understanding Date Formats in DATEPARSE

The key to using DATEPARSE is providing the correct format symbols that match your string. Each symbol represents a different part of the date. Here are the most common ones you'll need to know:

  • yyyy: Four-digit year (e.g., 2024)
  • yy: Two-digit year (e.g., 24)
  • MMMM: Full name of the month (e.g., January)
  • MMM: Three-letter abbreviation for the month (e.g., Jan)
  • MM: Two-digit number for the month (e.g., 01 for January)
  • dd: Two-digit day of the month (e.g., 05)
  • d: One or two-digit day of the month (e.g., 5)
  • HH: Hour in 24-hour format (00-23)
  • mm: Minutes (00-59)
  • ss: Seconds (00-59)

DATEPARSE In Action: Practical Examples

Let's create a calculated field to convert a string field named [Order Date_String].

Example 1: A Date string with periods as separators

Your data looks like: “01.25.2024”

Your calculated field formula should be:

DATEPARSE('MM.dd.yyyy', [Order Date_String])

This tells Tableau to expect a two-digit month, a period, a two-digit day, a period, and a four-digit year.

Example 2: A string that Includes the abbreviated month Name

Your string date looks like this: "Jan-25-24"

Your formula would be:

DATEPARSE('MMM-dd-yy', [Order Date_String])

Here, you're informing Tableau that the format includes the month's abbreviation (MMM), followed by a dash (-), a two-digit day (dd), another dash, then ending with the two-digit year (yy).

Example 3: String with full month name and spaces

Your date string resembles: "January 25 2024"

In this case the formula should look something like this:

DATEPARSE('MMMM dd yyyy', [Order Date_String])

Here we are indicating a full month name (MMMM), a space, a two-digit day (dd), another space, and finishing with our four-digit year (yyyy).

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Using the DATE() Function for More Complex Cases

The DATE() function works slightly differently. Instead of parsing a specific format, it constructs a valid Tableau date out of a string that is already in a recognized standard format (like "2024-01-25"). By itself, it can feel similar to the "Change Data Type" feature. However, its true power is unlocked when you combine it with string manipulation functions like LEFT(), MID(), and RIGHT() to build a valid date string from raw text that has a strange format.

This method is perfect for situations where dates are written in a non-traditional format without any form of separator at all such as YYYYMMDD.

DATE() In Action: Splicing Together a Date String

Let’s imagine your string date is written as: "20240125". In this all-numbers date formatted string, the first four digits represent the year, the next two represent the month, and the last two the day. We can pull apart this string to create a proper readable date Tableau can use.

  1. Create a New Calculated Field and call it [Order Date Corrected].
  2. Use string functions to split apart [Order Date_String] and insert your special character separator as (-), which will create a formatted date Tableau can read:
LEFT([Order Date_String], 4) + "-" + MID([Order Date_String], 5, 2) + "-" + RIGHT([Order Date_String], 2)

This will grab the first four characters (2024), the middle two (01 starting from character 5), and the last two (25). Finally, use - to include the dashes between your groups to produce 2024-01-25.

  1. Now, we are ready for the date function! Enclose the string with DATE() in the full formula:
DATE(LEFT([Order Date_String], 4) + "-" + MID([Order Date_String], 5, 2) + "-" + RIGHT([Order Date_String], 2))

Tableau will execute this string by working from the inside of the function towards the outside. The LEFT, MID, and RIGHT commands parse into sections, and then DATE() turns it into a real Tableau date.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Common Errors and How to Fix Them

Even with careful calculations, things can still go wrong. Here are some of the most common issues you'll run into and how to troubleshoot them.

Problem: My Calculated Field Returns Nulls

Getting Null is the most common sign that your conversion failed. Here's why this happens:

  • Your DATEPARSE format doesn't match the string: This is a simple mistake. Double-check your calculation against your string format. If your data uses /, your format string must use /. Even a simple mismatch in punctuation or letter case can break everything.
  • Your data format isn't consistent throughout your file: If most of the records are in yyyy-MM-dd style for instance (2023-11-20), but one in your dataset is written as November-20, a simple DATEPARSE calculation will break and return Null. For cases like these, use logic such as an IF or CASE statement to determine which format to use for each row type.
  • Trailing or leading spaces: Simple with strings, but extra spaces in your date can lead to error and prevent a date from being recognized in Tableau. The TRIM() function fixes this problem, removing the spaces from your formula:
DATEPARSE('MM/dd/yyyy', TRIM([Order Date_String]))
  • Dates with ordinal numbers "st", "nd", "th": If your data is saved with something like "January 21st, 2024", DATEPARSE will break. Use REPLACE() to remove unwanted text:
REPLACE(REPLACE(REPLACE([Order Date_String], "st", ""), "nd", ""), "th", "")

Now you can include your clean date string in the DATEPARSE function:

DATEPARSE('MMMM dd yyyy', REPLACE(REPLACE(REPLACE([Order Date_String], "st", ""), "nd", ""), "th", ""))

Final Thoughts

Converting strings into dates unlocks your data's true storytelling potential within Tableau. While Tableau's automatic Change Data Type function can handle the easy stuff, DATEPARSE and DATE() calculations are your tools for when the data is messier or you have inconsistencies to sort. You have the tools to tackle it all. These two solutions allow you to act as a data cleaner and create clear and accurate timelines from this and every other data project going forward.

Spending half a Monday figuring out strange date formats and fixing CSVs before you can even start your analysis is frustrating. It’s also one of the many reasons we built Graphed. Manual data prep shouldn't be the hardest part of finding an insight. Instead of fighting with calculated fields or complicated exports, we connect directly to your data sources like Google Analytics, Shopify, or Facebook Ads. Then you just ask for what you need - like, "chart our monthly Shopify revenue against our Google Ads cost for the last six months" - and instantly get a live dashboard. No parsing, no data wrangling, just the answers you need.

Related Articles