KNOWLEDGE BASE

Dates Display in Unix Epoch Time Instead of Date or Datetime


Published: 02 May 2013
Last Modified Date: 01 May 2017

Issue

Date field displays Unix epoch time instead of the date or datetime format.

Environment

Tableau Desktop

Resolution

Option 1: Convert to a Date Field

  1. Select Analysis > Create Calculated Field.
  2. Type the following into the Formula field, and then click OK:
    DATE(DATEADD('second', INT([Unix Date]), #1970-01-01#))

Option 2: Convert to a Datetime Field

  1. If the date is interpreted as a string instead of a number value, right-click the field and select Change Data TypeNumber.
  2. Select Analysis > Create Calculated Field.
  3. Type the following into the Formula field, and then click OK:
    DATEADD('hour',-8,(Date("1/1/1970") + ([Unix Date]/86400)))

Note: Both the above options assume that the date field is in seconds. If the field is in milliseconds (which is the standard for Unix), then it will need to be converted before using the following options. To do so, please divide the field by 1000.

Cause

The data source is using Unix epoch time. Tableau Desktop does not automatically convert this time format into a date or datetime format.
Did this article resolve the issue?