'Change timezone in Data studio

I have a table with a date field UTC timezone but I want to change it into another timezone in data studio. I have created a new field in data studio with this formula: TODATE(update_date,"America/Chicago") but it didn't work correctly. Any ideas? I won't change the source table to add a new column (date convert).



Solution 1:[1]

Time Zone calculations can now be done in Google Data Studio using the recently introduced (17 Sep 2020 Update) Date and Time functions.

0) Upgrade the Date Field

Ensure that the Date field has been upgraded to to the newer Date field type.

Added a GIF to elaborate:

1) America/Chicago

The Calculated Field below makes use of DATETIME_DIFF in conjunction with CURRENT_DATETIME to get the difference between the two Time Zones (UTC and America/Chicago), and then subtracts the difference in SECOND from the Date field (named Date in this Report):

PARSE_DATETIME(
    "%s",
    CAST(CAST(FORMAT_DATETIME("%s", Date)AS NUMBER) - DATETIME_DIFF(CURRENT_DATETIME("UTC"), CURRENT_DATETIME("America/Chicago"), SECOND)AS TEXT))

Google Data Studio Report and a GIF to elaborate:

enter image description here

Solution 2:[2]

I was looking for an answer to this for a long time and came across so many complex indirect approaches, till I was able to implement something which seems very easy and straight forward.

Basically, in the data source connection you set up the date selection field as :

DATE('your_timefield', @timezone)

In case if using date range parameter , it would be something like :

DATE('your_timefield', @timezone) BETWEEN PARSE_DATE('%Y%m%d', @DS_START_DATE) AND PARSE_DATE('%Y%m%d', @DS_END_DATE)

Next step, create a 'parameter' as below

TimeZone parameter

You can select any of the timezones as 'default'

Now within your report you can publish a drop down giving users option to switch between the timezones

timezone select Dropdown

works like a charm. Also, while using it for things like displaying time ( in trends or otherwise) use the same parameter in selecting date/time so the time field reflects the timezone as well. you can use the datetime function as below

DATETIME("your_timefield", @timezone) as your_timefield

Solution 3:[3]

If you can manipulate the data in BigQuery, DATE(update_date, "America/Chicago") should do the trick.

List of BigQuery's DATE function available arguments

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nimantha
Solution 2 Pranav Mishra
Solution 3 Diego Queiroz