KNOWLEDGE BASE

NOW() and TODAY() Functions Return Date Times in Unexpected Time Zone When Run Flow Tableau Prep Command Line


Published: 01 Jun 2020
Last Modified Date: 02 Jun 2020

Issue

Using NOW() or TODAY() functions in a calculated field, expected date time is displayed to Tableau Prep Builder GUI but different one is included in the output file after running the same flow by command line (CLI).

Environment

  • Tableau Prep Builder

Resolution

To modify the output result of the command line, use a calculation with the DATEADD() function to account for the time zone offset. To convert UTC to PST (Pacific Standard Time), the calculation formula including NOW() could become:
DATEADD('hour', -8, NOW())

Cause

On Tableau Prep Builder GUI, NOW() and TODAY() use the system timezone of the machine which Tableau Prep Builder installed in.
Tableau Prep Builder CLI refers the system timezone of the machine which the data source is hosted. The behavior is by design.
Did this article resolve the issue?