Contact Us

June 3, 2024

May 13, 2026 2:50 pm

Displaying Dynamic Timezones in Emails with Salesforce Marketing Cloud

Share with

Understanding the Challenge

The challenge arises because Salesforce Marketing Cloud server time does not observe daylight saving time (DST), which can lead to incorrect timezone displays. To overcome this, you need to calculate the timezone based on the server date and add the necessary adjustments for DST.

The root cause of this issue is that Salesforce Marketing Cloud server time does not account for DST, making it necessary to manually calculate the timezone.

Calculating Timezone with AMPScript, SSJS, or SQL

You can use AMPScript, SSJS, or SQL to calculate the timezone. The approach involves taking the server date, adding the difference from the server date to your date, and conditionally adding DST based on day/month. For example, if you are working with the AEST/AEDT timezone, you can hard code the adjustments based on the 1st Sunday of April and October.

ampscript.txt

%%[ var @serverDate = Now() var @aestDate = DateAdd(@serverDate, 10, "h") var @a edtDate = DateAdd(@serverDate, 11, "h") if @serverDate > "2023-04-01" and @serverDate < "2023-10-01" then @ timezone = "AEST" else @timezone = "AEDT" ]%%

Implementing the Solution

To implement the solution, you can follow these steps:

Checklist

  • Determine the timezone you need to display
  • Calculate the server date and add the necessary adjustments for DST
  • Use AMPScript, SSJS, or SQL to implement the calculation
  • Reference the calculated timezone in your email copy
  • Test the solution to ensure it works as expected
  • Consider using a data extension to store the timezone data for easy reference

In addition to these steps, you should also consider the following FAQs:

What if I need to display multiple timezones?

You can use a similar approach to calculate multiple timezones, but you will need to consider the different DST rules for each timezone.

Can I use a single AMPScript function to calculate the timezone?

While there is no single AMPScript function that includes timezone for date/time formatting, you can use a combination of functions to calculate the timezone.

How do I handle DST for timezones that do not follow the standard rules?

You will need to manually adjust the DST rules for timezones that do not follow the standard rules, such as the AEST/AEDT timezone.

Can I use SQL to calculate the timezone?

Yes, you can use SQL to calculate the timezone by using a similar approach to the AMPScript solution.

Blogs for the

Business-Savvy!​

Let’s Connect

A 30 min no cost strategy session
with cloud support expert

Let’s Connect

A 30 min no cost strategy session
with cloud support expert