Skip to main content

Configure Timezones for Your Tests

Many applications display dates, schedule events, or trigger time-sensitive logic based on the user's timezone. TestMu AI lets you set the timezone on the test VM using the timezone capability in LT:Options, so you can validate timezone-dependent behavior without changing your local machine settings. The capability accepts UTC offset strings (e.g., UTC+05:30).

Set the Timezone Using the timezone Capability


Pass a UTC offset string in LT:Options to configure the test VM's system timezone.

Add the timezone capability to your LT:Options configuration. The value is a UTC offset string in the format UTC+HH:MM or UTC-HH:MM (e.g., UTC+05:30). The default is UTC+00:00.

TimezoneTest.java
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import java.net.URL;
import java.util.HashMap;

public class TimezoneTest {
public static void main(String[] args) throws Exception {
ChromeOptions browserOptions = new ChromeOptions();
browserOptions.setPlatformName("Windows 11");
browserOptions.setBrowserVersion("latest");

HashMap<String, Object> ltOptions = new HashMap<>();
ltOptions.put("username", System.getenv("LT_USERNAME"));
ltOptions.put("accessKey", System.getenv("LT_ACCESS_KEY"));
ltOptions.put("timezone", "UTC-05:00");
ltOptions.put("project", "Timezone Test");
browserOptions.setCapability("LT:Options", ltOptions);

RemoteWebDriver driver = new RemoteWebDriver(
new URL("https://hub.lambdatest.com/wd/hub"), browserOptions);
driver.get("https://example.com");
driver.quit();
}
}

Common Timezone Values


Use these UTC offset strings with the timezone capability.

ValueRegion
UTC+00:00London, Coordinated Universal Time
UTC-05:00New York, Washington D.C. (US Eastern)
UTC-08:00Los Angeles, San Francisco (US Pacific)
UTC+01:00Berlin, Paris, Amsterdam
UTC+05:30Mumbai, Delhi, Bangalore
UTC+09:00Tokyo, Osaka
UTC+11:00Sydney, Melbourne
UTC+08:00Singapore, Hong Kong, Perth
UTC-03:00Sao Paulo, Buenos Aires
UTC+03:00Moscow, Istanbul
note

The timezone capability is case sensitive. Use the exact format UTC+HH:MM or UTC-HH:MM.

When to Configure Timezones


Set the timezone capability when your test validates time-sensitive application behavior.

Consider setting the timezone capability in these scenarios:

  • Scheduled events. Verify that calendar events, reminders, or notifications fire at the correct local time.
  • Date formatting. Confirm that dates and timestamps render in the expected format for a given locale.
  • Time-based business logic. Test features like cutoff times, availability windows, or session expiration that depend on the user's timezone.
  • Cross-timezone consistency. Run the same test suite across multiple timezones to catch discrepancies in time-dependent logic.
tip

Combine the timezone capability with geolocation to simulate a complete locale environment for your tests.

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles