![]() |
VOOZH | about |
dotnet add package TimeZoneConverter --version 7.2.0
NuGet\Install-Package TimeZoneConverter -Version 7.2.0
<PackageReference Include="TimeZoneConverter" Version="7.2.0" />
<PackageVersion Include="TimeZoneConverter" Version="7.2.0" />Directory.Packages.props
<PackageReference Include="TimeZoneConverter" />Project file
paket add TimeZoneConverter --version 7.2.0
#r "nuget: TimeZoneConverter, 7.2.0"
#:package TimeZoneConverter@7.2.0
#addin nuget:?package=TimeZoneConverter&version=7.2.0Install as a Cake Addin
#tool nuget:?package=TimeZoneConverter&version=7.2.0Install as a Cake Tool
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.
TimeZoneConverter NuGet package to your project.TimeZoneConverter namespace where needed.As of version 7.0.0, TimeZoneConverter works with all of the following:
.NET Framework versions less than 4.6.2 are no longer supported.
.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.
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.
This library uses a combination of data sources to achieve its goals:
MAPPING data from ActiveSupport::TimeZone in the Rails source code.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.
Additionally, 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.
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.
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" }
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.KnownIanaTimeZoneNamesTZConvert.KnownWindowsTimeZoneIdsTZConvert.KnownRailsTimeZoneNamesIf you need a list of time zones that are applicable in a given region, you can use:
TZConvert.GetIanaTimeZoneNamesByTerritory()This library is provided free of charge, under the terms of the MIT license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
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. |
|
|
Volo.Abp.Timing
Package Description |
|
|
Snowflake.Data
Snowflake Connector for .NET |
|
|
Abp
Abp |
|
|
TimeZoneNames
Provides localized time zone names. |
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.
|
|
|
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.
|
|
|
ProtonVPN/win-app
Official ProtonVPN Windows app
|
|
|
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
|
|
|
pnp/pnpcore
The PnP Core SDK is a modern .NET SDK designed to work for Microsoft 365. It provides a unified object model for working with SharePoint Online and Teams which is agnostic to the underlying API's being called
|
| Version | Downloads | Last Updated |
|---|---|---|
| 7.2.0 | 9,587,217 | 10/20/2025 |
| 7.1.0 | 171,053 | 10/17/2025 |
| 7.0.0 | 26,014,442 | 1/16/2025 |
| 6.1.0 | 74,130,670 | 2/12/2023 |
| 6.0.1 | 22,410,496 | 9/5/2022 |
| 6.0.0 | 522,903 | 9/3/2022 |
| 5.0.0 | 34,407,286 | 1/13/2022 |
| 4.0.0 | 107,081 | 1/11/2022 |
| 3.5.0 | 45,682,237 | 4/8/2021 |
| 3.4.0 | 12,970,493 | 2/13/2021 |
| 3.3.0 | 15,797,193 | 9/10/2020 |
| 3.2.0 | 37,069,991 | 6/4/2019 |
| 3.1.0 | 8,390,756 | 4/17/2019 |
| 3.0.0 | 1,085,086 | 3/19/2019 |
| 2.5.1 | 3,252,653 | 12/13/2018 |
| 2.5.0 | 27,894 | 12/13/2018 |
| 2.4.2 | 3,225,111 | 10/1/2018 |
| 2.4.1 | 2,908,948 | 4/25/2018 |
| 2.4.0 | 30,340 | 4/25/2018 |
| 2.3.2 | 538,954 | 3/27/2018 |