Finding Non-Standard Date Parts

Published: 09 May 2017
Last Modified Date: 10 May 2017


How to find non-standard date parts, such as millisecond.


Tableau Desktop


The attached example workbook uses the sample data set Superstore to demonstrate the following directions:
  1. Select Analysis > Create Calculated Field
  2. Name the calculated field. In this example, the calculated field is named "String Date". Create a calculation similar to the following, then click OK:

    STR( [Date] )

  3. Drag [String Date] to the Rows shelf. Count the position of the millisecond number as a number of characters including spaces and punctuation.
    In this example, the date was imported in the format yyyy-dd-MM hh:nn:ss.SSSS. The millisecond number is the 23rd character in this string.
  4. Create a calculated field with a name like "Millisecond Datepart" with a calculation similar to the following:

    INT( MID( STR( [Date] ), 23, 1 ) )

The above field will return the number of milliseconds as an integer.
Did this article resolve the issue?