How to Use Custom Time Zone in QuickSight Without Shifting Date-Only Fields

How to Use Custom Time Zone in QuickSight Without Shifting Date-Only Fields

If you’ve ever enabled Custom Time Zone in QuickSight and noticed that your date-only fields are getting shifted by a day, you’re not alone. QuickSight doesn’t distinguish between date-only and datetime fields. As a result, when a time zone is applied (e.g., UTC to CST) and crosses midnight, your purely date-based fields might be rolled back by one day.

Below is a straightforward workaround:

  1. Convert the date to a string in your dataset

  2. Parse it back to a date in your analysis

This approach ensures your date-only fields don’t get unintentionally shifted. Here’s how:


1. Dataset Calculated Field

Create a calculated field in your dataset to format the date as a string:


c_ds_service_date_str:

// QuickSight doesn't distinguish between date-only and datetime fields.

// Custom Time Zone applies a time zone shift to all "date" fields, even if there's no time component.

// For a pure date (no time), this can shift the date by one day if UTC -> CST crosses midnight.

// To avoid this incorrect shift, we convert the date to a string here and parse back at the analysis/runtime level.

formatDate({service_date}, 'yyyy-MM-dd')


2. Analysis Calculated Field

Next, create a calculated field in your analysis to parse that string back into a date:


c_service_date:

// Convert the string back to a date. By storing it as a string in the dataset,

// we bypassed the unwanted custom time zone shift on a date-only field.

parseDate({c_ds_service_date_str}, 'yyyy-MM-dd')


3. Repeat for All Date-Only Fields

Apply the same pattern to any other date-only fields that appear in your visuals.

(Note: Actual timestamps will still be converted by Custom Time Zone as expected.)


Reference

For more details on working with date and time fields in QuickSight, check out the official documentation.


Summary

This method effectively keeps QuickSight from shifting your date-only values when a time zone conversion occurs. By treating pure date fields as strings in the dataset layer and converting them back in the analysis layer, you preserve the original date. This is especially helpful when reporting or visualizing daily metrics without unintended time-based offsets.

Hope this helps! If you have any questions or insights, feel free to share them in the comments.

1 Like