TimeZoneConverter 8.0.0

dotnet add package TimeZoneConverter --version 8.0.0
                    
NuGet\Install-Package TimeZoneConverter -Version 8.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TimeZoneConverter" Version="8.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TimeZoneConverter" Version="8.0.0" />
                    
Directory.Packages.props
<PackageReference Include="TimeZoneConverter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TimeZoneConverter --version 8.0.0
                    
#r "nuget: TimeZoneConverter, 8.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TimeZoneConverter@8.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TimeZoneConverter&version=8.0.0
                    
Install as a Cake Addin
#tool nuget:?package=TimeZoneConverter&version=8.0.0
                    
Install as a Cake Tool

TimeZoneConverter NuGet Version


TimeZoneConverter is a lightweight library to convert quickly between IANA, Windows, and Rails time zone names.

Note: A separate TimeZoneConverter.Posix package is also available if you need POSIX time zone support.

Installation

  • Add the TimeZoneConverter NuGet package to your project.
  • Import the TimeZoneConverter namespace where needed.

Compatibility

As of version 8.0.0, TimeZoneConverter works with all of the following:

  • .NET 5 and newer, with dedicate targets for .NET 8, .NET 9, and .NET 10
  • .NET Core 2.0 or greater
  • .NET Framework 4.6.2 and greater

.NET Framework versions less than 4.6.2 are no longer supported.

Important note on .NET 6+

.NET 6 has built-in support for IANA and Windows time zones in a cross-platform manner, somewhat reducing the need for this library. It relies on .NET's ICU integration to perform this functionality. See the .NET blog for details.

Restated, if you are targeting only .NET 6 (or higher), and you have either platform-provided or App-local ICU enabled, you might not need to use this library. However, it is indeed still supported, and many have found it continues to be useful in certain environments or on specific platforms.

TimeZoneConverter has no external data dependencies at runtime. All of the data it needs is embedded in the library itself.

Note on OS Data Dependencies

Some functions in TimeZoneConverter, such as TZConvert.GetTimeZoneInfo rely on the underlying TimeZoneInfo object having access to time zone data of the operating system. On Windows, this data comes from the registry and is maintained via Windows Updates.

On OSX and Linux, this data comes from a distribution of the IANA time zone database, usually via the tzdata package. If your environment does not have the tzdata package installed, you will need to install it for TZConvert.GetTimeZoneInfo to work correctly.

For example, the Alpine Linux Docker images for .NET Core no longer ship with tzdata. See dotnet/dotnet-docker#1366 for instructions on how to add it to your Docker images.

Implementation Details

This library uses a combination of data sources to achieve its goals:

Usually, the latter is reserved for edge cases, and for newly-introduced zones that may or may not have been published to official sources yet.

Important: Since this data can change whenever new time zones are introduced from any of these sources, it is recommended that you always use the most current revision, and check for updates regularly.

Generally, this library does not attempt to determine if the time zone IDs provided are actually present on the computer where the code is running. It is assumed that the computer is kept current with time zone updates.

For example, if one attempts to convert Africa/Khartoum to a Windows time zone ID, they will get Sudan Standard Time. If it is then used on a Windows computer that does not yet have KB4051956 installed (which created this time zone), they will likely get a TimeZoneNotFoundException.

An exception is made for the 2026 Canadian time zone changes because of the very short timeframe between the new Windows time zones becoming available and the changes taking effect. This allows users to upgrade the library in advance while retaining the previous mappings until the Windows updates are installed. When running on Windows, IANA-to-Windows and Rails-to-Windows conversions automatically use the previous mapping if the new Windows ID is not installed:

New Windows ID Fallback ID
British Columbia Standard Time Pacific Standard Time
Alberta Standard Time Mountain Standard Time
Manitoba Standard Time Central Standard Time

Availability is cached when system time zones are first loaded. Restart applications after installing Windows time zone updates to use the new IDs. Non-Windows systems always return the current mappings. The embedded mappings, known-zone lists, and territory lists remain current regardless of installed updates.

These fallbacks preserve the previous library behavior, but their seasonal rules are incorrect after the November 1, 2026 permanent-DST transition. Install the Windows updates for correct offsets; the fallback is not a replacement for those updates.

Unmappable Zones

It is possible for a zone to be unmappable - meaning that there is no logical equivalent from one type of time zone to another.

Currently there is only one IANA zone that is unmappable to Windows, which is Antarctica/Troll. In other words, there is no "correct" time zone for Windows users who may happen to be stationed in Troll Station, Antarctica. Therefore, if you try to convert Antarctica/Troll to Windows, you will get a TimeZoneNotFoundException.

There are many zones that are unmappable to Rails. The complete list is in the unit test code here.

Example Usage

Convert an IANA time zone name to the best fitting Windows time zone ID.

string tz = TZConvert.IanaToWindows("America/New_York");
// Result:  "Eastern Standard Time"

Convert a Windows time zone name to the best fitting IANA time zone name.

string tz = TZConvert.WindowsToIana("Eastern Standard Time");
// result:  "America/New_York"

Convert a Windows time zone name to the best fitting IANA time zone name, with regard to a specific country.

string tz = TZConvert.WindowsToIana("Eastern Standard Time", "CA");
// result:  "America/Toronto"

Get a TimeZoneInfo object from .NET Core, regardless of what OS you are running on:

// Either of these will work on any platform:
TimeZoneInfo tzi = TZConvert.GetTimeZoneInfo("Eastern Standard Time");
TimeZoneInfo tzi = TZConvert.GetTimeZoneInfo("America/New_York");

Convert a Rails time zone name to the best fitting IANA time zone name.

string tz = TZConvert.RailsToIana("Mexico City");
// result:  "America/Mexico_City"

Convert a Rails time zone name to the best fitting Windows time zone ID.

string tz = TZConvert.RailsToWindows("Mexico City");
// result:  "Central Standard Time (Mexico)"

Convert an IANA time zone name to one or more Rails time zone names.

IList<string> tz = TZConvert.IanaToRails("America/Mexico_City");
// Result:  { "Guadalajara", "Mexico City" }

Convert a Windows time zone ID to one or more Rails time zone names.

IList<string> tz = TZConvert.WindowsToRails("Central Standard Time (Mexico)");
// Result:  { "Guadalajara", "Mexico City" }

Initialization

Mapping data and system time zones are loaded lazily and independently. Known-zone lists and most identifier conversions load only the mapping data.

To move both initialization costs to application startup, call:

TZConvert.Initialize();

This method is synchronous, thread-safe, and safe to call repeatedly. Concurrent callers that need the same data wait for it to finish loading.

External mapping data

You can distribute mapping updates independently of the library as a single TimeZoneData.zip bundle. The data builder produces this file in src/TimeZoneConverter/Data; the library embeds the same bundle for its default behavior. Applications control where external bundles come from:

using var stream = File.OpenRead("TimeZoneData.zip");
TZConvert.Initialize(stream);

For streams that perform asynchronous I/O:

using var stream = await httpClient.GetStreamAsync(dataUrl);
await TZConvert.InitializeAsync(stream, cancellationToken);

Both overloads read from the current position, support non-seekable streams, leave the stream open, and do not retain it. Async initialization buffers the stream asynchronously; parsing and system time zone initialization are synchronous. Bundles are limited to 4 MiB, with each CSV limited to 4 MiB after decompression.

Supply custom data before mappings are first used, and await initialization before accepting requests. Custom initialization throws InvalidOperationException if mapping initialization has already started, including if another caller selects embedded data while the bundle is being retrieved. Failed retrieval, cancellation before committing the mappings, or invalid data leaves custom initialization uncommitted. Parameterless Initialize() remains safe to repeat; custom initialization cannot replace loaded mappings.

Bundle format version 1 is a ZIP containing these entries at its root:

  • manifest.txt: UTF-8 text TimeZoneConverter/1 (an optional trailing newline is allowed).
  • Mapping.csv: Windows ID, territory code, space-separated IANA IDs.
  • Aliases.csv: canonical IANA ID, space-separated aliases.
  • RailsMapping.csv: Rails name, space-separated IANA IDs.
  • Territories.csv: territory code, space-separated IANA IDs.

CSVs are UTF-8 without headers or quoting. All four datasets are required and must come from a compatible release. Incomplete, malformed, or unsupported bundles fail rather than mix external and embedded data. External bundles update identifier mappings, not the operating-system time zone rules used by TimeZoneInfo.

Extras

There are a few additional helpers you may find useful.

  • These properties provide lists of the various types of time zones known to this library:

    • TZConvert.KnownIanaTimeZoneNames
    • TZConvert.KnownWindowsTimeZoneIds
    • TZConvert.KnownRailsTimeZoneNames
  • If you need a list of time zones that are applicable in a given region, you can use:

    • TZConvert.GetIanaTimeZoneNamesByTerritory()

License

This library is provided free of charge, under the terms of the MIT license.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (368)

Showing the top 5 NuGet packages that depend on TimeZoneConverter:

Package Downloads
Fluid.Core

Fluid is a template engine based on the Liquid markup, with focus on performance and .NET programming patterns.

Snowflake.Data

Snowflake Connector for .NET

Volo.Abp.Timing

Package Description

TimeZoneNames

Provides localized time zone names.

Abp

Abp

GitHub repositories (45)

Showing the top 20 popular GitHub repositories that depend on TimeZoneConverter:

Repository Stars
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
aspnetboilerplate/aspnetboilerplate
ASP.NET Boilerplate - Web Application Framework
Kareadita/Kavita
Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
quartznet/quartznet
Quartz Enterprise Scheduler .NET
t1m0thyj/WinDynamicDesktop
Port of macOS Mojave Dynamic Desktop feature to Windows
Azure/azure-powershell
Microsoft Azure PowerShell
ErsatzTV/legacy
Open-source platform that transforms your personal media library into live, custom TV channels.
ProtonVPN/win-app
Official ProtonVPN Windows app
vietnam-devs/coolstore-microservices
A full-stack .NET microservices build on Dapr and Tye
apache/lucenenet
Apache Lucene.NET is an open-source full-text search library written in C#, ported from the Apache Lucene project.
ArduPilot/MissionPlanner
Mission Planner Ground Control Station for ArduPilot (c# .net)
microsoft/WhatTheHack
A collection of challenge based hack-a-thons including student guide, coach guide, lecture presentations, sample/instructional code and templates. Please visit the What The Hack website at: https://aka.ms/wth
sebastienros/fluid
Fluid is an open-source .NET template engine based on the Liquid template language.
Flangvik/TeamFiltration
TeamFiltration is a cross-platform framework for enumerating, spraying, exfiltrating, and backdooring O365 AAD accounts
cocoa-mhlw/cocoa
HTBox/allReady
This repo contains the code for allReady, an open-source solution focused on increasing awareness, efficiency and impact of preparedness campaigns as they are delivered by humanitarian and disaster response organizations in local communities.
rocksdanister/weather
Windows native weather app powered by DirectX12 animations
SparkDevNetwork/Rock
An open source CMS, Relationship Management System (RMS) and Church Management System (ChMS) all rolled into one.
pnp/PnP-Tools
Scripts and tools for Office 365 and SharePoint - More for IT Pro's
DotHarness/dotcraft
The agent harness for .NET: embeddable, extensible, remotely controllable and ready to use.
Version Downloads Last Updated
8.0.0 77,314 10/12/2026
7.2.0 23,500,250 10/20/2025
7.1.0 246,751 10/17/2025
7.0.0 34,978,973 1/16/2025
6.1.0 84,463,494 2/12/2023
6.0.1 24,375,638 9/5/2022
6.0.0 614,152 9/3/2022
5.0.0 36,395,369 1/13/2022
4.0.0 129,428 1/11/2022
3.5.0 47,965,066 4/8/2021
3.4.0 13,466,837 2/13/2021
3.3.0 16,357,965 9/10/2020
3.2.0 38,042,974 6/4/2019
3.1.0 8,525,974 4/17/2019
3.0.0 1,118,259 3/19/2019
2.5.1 3,322,614 12/13/2018
2.5.0 28,295 12/13/2018
2.4.2 3,256,309 10/1/2018
2.4.1 2,972,793 4/25/2018
2.4.0 31,528 4/25/2018
Loading failed