KNOWLEDGE BASE

Converting a Date Time Field to Another Time Zone Accounting for Daylight Savings


Published: 19 Apr 2017
Last Modified Date: 20 Apr 2017

Question

How to convert a date time field to another time zone accounting for daylight savings. For example:
  • Arizona uses MT but does not use daylight savings
  • Washington uses PDT starting March 12 and ending November 5
  • Therefore, between March 12 and November 5, there is no time difference between Washington and Arizona, but the rest of the year Arizona is one hour ahead.

Environment

Tableau Desktop

Answer

Create a calculation that conditionally adds a different number of hours based on what the date is. Based on the above example, the following formula could be used:
IF [Date Field] >= DATE( "3/12/" + YEAR( [Date Field] ) )
AND TODAY < DATE( "11/5/" + YEAR( [Date Field] ) )
THEN [Date Field]
ELSE DATEADD( 'hour', 1, [Date Field] )
END

 

Did this article resolve the issue?