TimezoneFormatIANAUTC

Provides either the full IANA timezone identifier or the corresponding UTC offset for TradingView’s built-in variables and functions.
tz(_tzname, _format)
Parameters:
_tzname (string): "London", "New York", "Istanbul", "+1:00", "-03:00" etc.
_format (string): "IANA" or "UTC"
Returns: "Europe/London", "America/New York", "UTC+1:00"
Example Code
Parameter Format Guide
This section explains how to properly format the parameters for the
_tzname (string) must be either;
- A valid timezone name exactly as it appears in the chart’s lower-right corner (e.g. New York, London).
- A valid UTC offset in ±H:MM or ±HH:MM format. Hours: 0–14 (zero-padded or not, e.g. +1:30, +01:30, -0:00). Minutes: Must be 00, 15, 30, or 45
examples;
- "New York" → ✅ Valid chart label
- "London" → ✅ Valid chart label
- "Berlin" → ✅ Valid chart label
- "America/New York" → ❌ Invalid chart label. (Use "New York" instead)
- "+1:30" → ✅ Valid offset with single-digit hour
- "+01:30" → ✅ Valid offset with zero-padded hour
- "-05:00" → ✅ Valid negative offset
- "-0:00" → ✅ Valid zero offset
- "+1:1" → ❌ Invalid (minute must be 00, 15, 30, or 45)
- "+2:50" → ❌ Invalid (minute must be 00, 15, 30, or 45)
- "+15:00" → ❌ Invalid (hour must be 14 or below)
_tztype (string) must be either;
- "IANA" → returns full IANA timezone identifier (e.g. "Europe/London"). When a time function call uses an IANA time zone identifier for its timezone argument, its calculations adjust automatically for historical and future changes to the specified region’s observed time, such as daylight saving time (DST) and updates to time zone boundaries, instead of using a fixed offset from UTC.
- "UTC" → returns UTC offset string (e.g. "UTC+01:00")
Bibliothèque Pine
Dans le plus pur esprit TradingView, l'auteur a publié ce code Pine en tant que bibliothèque open-source afin que d'autres programmeurs Pine de notre communauté puissent le réutiliser. Bravo à l'auteur! Vous pouvez utiliser cette bibliothèque en privé ou dans d'autres publications à code source ouvert, mais la réutilisation de ce code dans des publications est régie par nos Règles.
Clause de non-responsabilité
Bibliothèque Pine
Dans le plus pur esprit TradingView, l'auteur a publié ce code Pine en tant que bibliothèque open-source afin que d'autres programmeurs Pine de notre communauté puissent le réutiliser. Bravo à l'auteur! Vous pouvez utiliser cette bibliothèque en privé ou dans d'autres publications à code source ouvert, mais la réutilisation de ce code dans des publications est régie par nos Règles.