Date format changes upon converting Date&Time to String

Published: 03 Jul 2020
Last Modified Date: 08 Jul 2022


Date format changes from e.g. [2020-12-01 06:12:49] to [Dec 1 2020 6:12:49] when you convert the data type of a field from Date&Time to String. This occurs when using the live data source connection to Oracle or SQL Server.


  • Tableau Desktop 
  • Oracle, SQL Server


Make a Calculation Filed to change the data format which matches  [2020-12-01 06:12:49] as a String.

STR(YEAR([Date]))+ "-"
+ (IF MONTH([Date])<10 THEN "0"+STR(MONTH([Date])) ELSE STR(MONTH([Date])) END) + "-"
+(IF DAY([Date])<10 THEN "0"+STR(DAY([Date])) ELSE STR(DAY([Date])) END)+ " "


Within a Live connection with some data bases(Oracle, SQL Server), When change data type from Date(Date&Time) to String,
the Query from Tableau to database will be automatically issued which changes the format of String in query.

Additional Information

Did this article resolve the issue?