How to Split Date and Time in Tableau

Cody Schneider7 min read

Working with datetime fields is a common task in data analysis, but often, you'll find the date and time bundled together in a single column. This article will show you how to split a combined datetime field into separate date and time columns in Tableau, opening up a whole new level of analysis.

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 Should You Split Date and Time Columns?

You might wonder why you need to separate date and time in the first place. Keeping them in a single field can be limiting for a few key reasons. By splitting them, you enable more granular analysis, create more intuitive dashboards, and even improve performance.

  • Granular Time-Based Analysis: Splitting the time out allows you to analyze patterns by time of day, regardless of the date. You can answer questions like, "What are our busiest hours for sales?" or "When do we get the most website traffic on Tuesdays?" This is nearly impossible to visualize cleanly when date and time are combined.
  • Simplified Aggregations: Having a separate date column simplifies aggregations by day, week, month, or year. It's much easier to use Tableau's built-in date hierarchies when you're working with a pure date field.
  • User-Friendly Filters: A user on a dashboard is much more likely to want to filter by a specific date range or a specific time window (e.g., "business hours between 9 AM and 5 PM"). Providing separate filters for date and time is far more intuitive for your audience than asking them to navigate a single, complex datetime filter.
  • Improved Performance: In some cases, particularly on large datasets, Tableau can process separate date and time-only fields more efficiently than it can a single, highly granular datetime field.

Method 1: Using the Built-in Split Function (The Quickest Method)

The simplest way to separate date and time in Tableau is by using the built-in split functionality. This works best when your datetime data is consistently formatted with a clear separator, like a space, between the date and time parts (e.g., "2024-07-26 14:30:15").

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.

Step-by-Step Guide:

  1. Navigate to the Data Source Pane: Start by connecting to your data source. In the bottom left corner, click on the "Data Source" tab to view your data in a grid format.
  2. Locate Your Datetime Column: Find the column that contains the combined date and time information. It will typically have a calendar-with-a-clock icon next to its name.
  3. Use the "Split" Option: Click on the small dropdown arrow at the top of your datetime column. From the menu that appears, hover over "Split."
  4. Review the New Columns: Tableau will create two (or more) new columns, usually named something like "[Your Datetime Field] - Split 1" and "[Your Datetime Field] - Split 2". Your original column remains unchanged.
  5. Change the Data Types (Crucial Step): After splitting, Tableau often defaults the new columns to a "String" (Abc) or even a numeric (#) data type. You need to correct this.
  6. Rename for Clarity: Finally, double-click the [Your Datetime Field] - Split 1 name and give it a clearer name, such as "Order Date." Do the same for the time column, naming it "Order Time."

This method is fantastic for a quick fix, especially with clean, well-structured data.

Method 2: Using Calculated Fields (A More Powerful & Flexible Approach)

For more control, or when the built-in split feature doesn't work perfectly (e.g., your data format isn't standard), calculated fields are your best friend. They allow you to write simple formulas to extract exactly what you need.

Extracting the Date Part

You have two great functions for pulling out just the date.

1. The DATE() Function

This is the most direct way to get only the date from a datetime field.

  • Go to your sheet/worksheet view, right-click on an empty space in the Data pane on the left, and select "Create Calculated Field." Name it "Order Date (Calc)" and enter the following formula:
  • That's it! Tableau creates a new field that contains only the date values from your original column. This is incredibly clean and efficient.

2. The DATETRUNC() Function

The DATETRUNC function is slightly different. Instead of changing the data type to Date, it "truncates" the datetime to the start of a specified date part. To use it for grabbing the date, you truncate to the beginning of the 'day'.

  • Create another calculated field named "Order Date (Trunc)" with this formula:
  • For an entry like '2024-07-26 14:30:15', this function will return '2024-07-26 00:00:00'. The time is zeroed out, effectively giving you just the date for analytical purposes. The field itself remains a Datetime type, which can be useful for certain types of date difference 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

Extracting the Time Part

Getting the time is a little less straightforward but easily doable with calculated fields.

1. Using MAKETIME() and DATEPART()

  • Tableau does not have a dedicated TIME() function like it does for DATE(). The best way to create a true time value is by building it from its components: hours, minutes, and seconds using the DATEPART() and MAKETIME() functions.
  • Create a calculated field called "Order Time (Calc)" with the formula:
  • This might look complex, but it's very logical:
  • The MAKETIME() function then takes these three numbers and constructs a time value that Tableau recognizes.

2. A Simple but Messy Alternative (String Conversion)

  • Another, quicker-but-less-robust method is to convert the whole datetime field into a string and then split it within a calculation. This should only be used if MAKETIME isn't an option for some reason, as it can be less performant.
  • You can create a calculated field with:
  • This converts the datetime to a string, finds the space, and returns the second part (the time). However, the result is a string, not a numerical time value, which limits you from performing calculations and requires precise string formatting for correct sorting.

Method 3: Splitting in Tableau Prep (For Data Cleaning Workflows)

If you're already using Tableau Prep Builder to clean and prepare your data before analyzing it in Tableau Desktop, this is the ideal place to handle the split. Performing this task in Prep means you're creating a clean, structured data source that you and others can use repeatedly.

Steps for Splitting in Tableau Prep:

  1. Connect to your data in Tableau Prep Builder.
  2. Add a Clean Step to your workflow.
  3. In the profile pane, find and select your datetime column.
  4. Click the … (More Options) menu.
  5. Go to Split Values and choose Automatic Split. Just like in Desktop, Prep will automatically find the space delimiter and create new fields.
  6. Rename and Re-Type the new fields. This is the most important part. Tableau Prep has better data type support than Desktop for this purpose. You can set one column to the "Date" data type and the other to the "Time" data type directly. This is a significant advantage over the Desktop method.
  7. Add an Output step to generate your clean .hyper extract or publish the data source to Tableau Server/Cloud.

By doing this in your Prep flow, every time you build a workbook from that data source, the date and time will already be separated correctly.

Final Formatting in Your Worksheet

Once you have your fields, remember to format them for your visualization.

  • Right-click your new Date field in the data pane, go to Default Properties > Date Format... and choose how you want it to appear (e.g., "March 1, 2024").
  • Right-click your new Time field, go to Default Properties > Date Format... > Custom. Here you can enter a format string like hh:nn:ss AMPM to display just the time properly (e.g., "02:30:15 PM").

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.

Final Thoughts

Splitting date and time in Tableau is an essential skill that transforms a cumbersome single field into two powerful columns for deep analysis. You can do it quickly with the built-in split feature, get more precise control with calculated fields like DATE() and MAKETIME(), or build it into a repeatable cleaning workflow with Tableau Prep. Knowing these methods gives you the flexibility to handle any datetime format you encounter.

Manual data preparation tasks like splitting fields or writing formulas - even once you know how - represent the tedious busywork that eats into valuable time for actual analysis. At Graphed, we've built a platform that lets you bypass these manual steps. With our simple natural language interface, you can just connect your data source and ask, "Show me a chart of sales by hour of the day" and get an interactive visualization back in seconds. Instead of a multi-step process for one chart, you get immediate insights, created for you automatically with Graphed.

Related Articles