Afk.ZoneInfo 4.1.0

.NET Standard 2.0
dotnet add package Afk.ZoneInfo --version 4.1.0
NuGet\Install-Package Afk.ZoneInfo -Version 4.1.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="Afk.ZoneInfo" Version="4.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Afk.ZoneInfo --version 4.1.0
#r "nuget: Afk.ZoneInfo, 4.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Afk.ZoneInfo as a Cake Addin
#addin nuget:?package=Afk.ZoneInfo&version=4.1.0

// Install Afk.ZoneInfo as a Cake Tool
#tool nuget:?package=Afk.ZoneInfo&version=4.1.0


Afk.ZoneInfo is an alternative to the framework class System.TimeZoneInfo.

The Afk.ZoneInfo use the Iana timezone database (previously named Olson Database). By default the library is linked with a database files. You can override it with recent files, for this set the environment variable TZDIR with the new directory of database files.


The library is compatible with netstandard2.0


The easiest way to install is by using NuGet.


Local time zone can be retrieve by the static TzTimeZone.CurrentTzTimeZone member. The following code uses the CurrentTzTimeZone to return the local times that correspond to UTC.

TzTimeZone local = TzTimeZone.CurrentTzTimeZone;

Specific time zone can be retrieve by the static TzTimeInfo.GetZone function and translation are provide by ToLocalTime and ToUniversalTime functions.

DateTime dateLocal = new DateTime(2011, 1, 5, 10, 0, 0, DateTimeKind.Local);
TzTimeZone paris = TzTimeInfo.GetZone("Europe/Paris");
TzTimeZone ny = TzTimeInfo.GetZone("America/New_York");
DateTime dateUtc = paris.ToUniversalTime(dateLocal);
Console.WriteLine("Local time at paris : " + dateLocal + " UTC : " + dateUtc);
Console.WriteLine("Local time at new york : " + ny.ToLocalTime(dateUtc));
Console.WriteLine("Paris : " + dateLocal + " New york " + paris.ToTimeZone(dateLocal, ny));

The previous code generates the following output :

Local time at paris : 05/01/2011 10:00:00 UTC : 05/01/2011 09:00:00
Local time at new york : 05/01/2011 04:00:00
Paris : 05/01/2011 10:00:00 New york : 05/01/2011 04:00:00

Retrieve TimeZone

TzTimeZone can be retrieve directly by members of class Afk.ZoneInfo.Zones.

TzTimeZone timeZone = Afk.ZoneInfo.Zones.America.New_York;

However you can use the static functions of class Afk.ZoneInfo.TzTimeInfo to enumerate all available zones.

Function Description
GetCountries Gets all countries
GetCountriesCode Gets all countries code
GetZone Gets the TzTimeZone related to the zone name specified
GetZones Gets all TzTimeZone
GetZoneNames Gets all timezone name
FindSystemTzTimeZoneById Gets the TzTimeZone related to the windows id specified
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.1.0 119 10/31/2022
4.0.0 1,301 7/28/2022
3.0.0 31,549 11/10/2019
2.4.0 39,280 8/21/2018
2.0.0 1,568 8/16/2017
1.4.0 2,581 12/20/2015