Time zones
Overview
Time on the time scale is displayed according to the chart time zone.
To set the default time zone, specify the timezone
property in the Widget Constructor.
var widget = window.tvWidget = new TradingView.widget({
// ...
overrides: {
"timezone": "America/New_York",
}
});
You can change the default time zone on the fly using the applyOverrides
method.
widget.applyOverrides({ "timezone": "Europe/Belgrade"});
Besides the time zone of the chart, you should also specify the time zone for each symbol. Make sure you provide correct values as it affects how the library aligns and displays the data. Refer to Symbology for more information.
Manage time zone
Call the getTimezoneApi
method to get an instance of the ITimezoneApi
interface. This interface provides an extensive API for managing time zone settings. For example, you can change the current time zone as follows:
widget.activeChart().getTimezoneApi().setTimezone("America/Chicago");
In the UI, users can switch the time zone from the drop-down list at the bottom of the chart or through the Settings dialog.
Supported time zones
The library supports the following time zones:
Etc/UTC
Africa/Cairo
Africa/Casablanca
Africa/Johannesburg
Africa/Lagos
Africa/Nairobi
Africa/Tunis
America/Anchorage
America/Argentina/Buenos_Aires
America/Bogota
America/Caracas
America/Chicago
America/El_Salvador
America/Juneau
America/Lima
America/Los_Angeles
America/Mexico_City
America/New_York
America/Phoenix
America/Santiago
America/Sao_Paulo
America/Toronto
America/Vancouver
Asia/Astana
Asia/Ashkhabad
Asia/Bahrain
Asia/Bangkok
Asia/Chongqing
Asia/Colombo
Asia/Dhaka
Asia/Dubai
Asia/Ho_Chi_Minh
Asia/Hong_Kong
Asia/Jakarta
Asia/Jerusalem
Asia/Karachi
Asia/Kathmandu
Asia/Kolkata
Asia/Kuala_Lumpur
Asia/Kuwait
Asia/Manila
Asia/Muscat
Asia/Nicosia
Asia/Qatar
Asia/Riyadh
Asia/Seoul
Asia/Shanghai
Asia/Singapore
Asia/Taipei
Asia/Tehran
Asia/Tokyo
Asia/Yangon
Atlantic/Azores
Atlantic/Reykjavik
Australia/Adelaide
Australia/Brisbane
Australia/Perth
Australia/Sydney
Europe/Amsterdam
Europe/Athens
Europe/Belgrade
Europe/Berlin
Europe/Bratislava
Europe/Brussels
Europe/Bucharest
Europe/Budapest
Europe/Copenhagen
Europe/Dublin
Europe/Helsinki
Europe/Istanbul
Europe/Lisbon
Europe/London
Europe/Luxembourg
Europe/Madrid
Europe/Malta
Europe/Moscow
Europe/Oslo
Europe/Paris
Europe/Prague
Europe/Riga
Europe/Rome
Europe/Stockholm
Europe/Tallinn
Europe/Vienna
Europe/Vilnius
Europe/Warsaw
Europe/Zurich
Pacific/Auckland
Pacific/Chatham
Pacific/Fakaofo
Pacific/Honolulu
Pacific/Norfolk
US/Mountain
If your time zone is not supported, you can request it on GitHub Issues 🔐 (access is restricted) or add your custom time zone.
Custom time zones
You can specify a custom time zone using the custom_timezones
property in the Widget Constructor.
Just like the built-in time zones, custom time zones will appear in the drop-down list and chart settings. You can also use them to specify time zones for symbols.
You should map (alias) a custom time zone to either a built-in or GMT-based time zone one. Ensure that the alias time zone correctly matches your desired time zone in all aspects including daylight saving time dates.
The code sample below adds the following time zones:
- the Cape Town time zone aliased to the built-in time zone of Johannesburg.
- the Nuuk time zone aliased to a GMT-based time zone.
var widget new TradingView.widget({
// ...
custom_timezones: [
{
id: "Africa/Cape_Town",
alias: "Africa/Johannesburg",
title: "Cape Town",
},
{
id: "America/Nuuk",
alias: "Etc/GMT+3",
title: "Nuuk",
},
],
}));
GMT-based time zones
You can map your custom time zone to a GMT-based time zone. GMT-based time zones can only be used in the alias
property of a custom time zone object.
The GMT-based time zones should be specified in the following format:
Element | Description |
---|---|
Etc/GMT | The default beginning. |
+ or - | The sign showing the offset direction. |
Number | The number of hours offset. |
: | A separator between hours and minutes. |
Number (Optional) | The number of minutes offset. |
To conform with the POSIX style, time zone names use a sign that is reversed from the standard ISO 8601 convention. In the Etc/
namespace, time zones west of GMT have a positive sign, and those east of GMT have a negative sign.
Examples
Etc/GMT+0
: same asEtc/UTC
Etc/GMT+2
: 2 hours behind GMTEtc/GMT-4
: 4 hours ahead of GMTEtc/GMT-3:21
: 3 hours and 21 minutes ahead of GMT