MakoIoT.Device.Utilities.TimeZones 1.0.51.19445

dotnet add package MakoIoT.Device.Utilities.TimeZones --version 1.0.51.19445
                    
NuGet\Install-Package MakoIoT.Device.Utilities.TimeZones -Version 1.0.51.19445
                    
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="MakoIoT.Device.Utilities.TimeZones" Version="1.0.51.19445" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MakoIoT.Device.Utilities.TimeZones" Version="1.0.51.19445" />
                    
Directory.Packages.props
<PackageReference Include="MakoIoT.Device.Utilities.TimeZones" />
                    
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 MakoIoT.Device.Utilities.TimeZones --version 1.0.51.19445
                    
#r "nuget: MakoIoT.Device.Utilities.TimeZones, 1.0.51.19445"
                    
#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 MakoIoT.Device.Utilities.TimeZones@1.0.51.19445
                    
#: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=MakoIoT.Device.Utilities.TimeZones&version=1.0.51.19445
                    
Install as a Cake Addin
#tool nuget:?package=MakoIoT.Device.Utilities.TimeZones&version=1.0.51.19445
                    
Install as a Cake Tool

Mako-IoT.Device.Utilities.TimeZones

The way to get local date & time on your device. Given time zone definition the library converts UTC to local time, handles Daylight Saving Time transitions as well.

Usage

Create TimeZone object

Time zone without DST

var timezone = new TimeZone(utcOffset);

Time zone with DST

var timezone = new TimeZone(standardUtcOffset, dstUtcOffset, dstStarts, dstEnds);

DST transition dates

Time zones across the globe have various rules about transition to and from DST. To accomodate that we can provide transition dates in two ways:

  1. FixedDate - fixed month and day of the year
//DST starts every year on the 20th of June at 2:00 AM
var dstStarts = new FixedDate(new DateTime(2023, 20, 6, 2, 0, 0));
  1. FloatingDate - weekday of given week in a month
//DST starts on the second Sunday of March at 2:00 AM
var dstStarts = new FloatingDate(3, 2, DayOfWeek.Sunday, 2, 0, 0);

Get date & time

Getting local time

var localTime = timezone.GetLocalTime(utcDateTime);

Check if DST is observed at given date and time

var isDst = timezone.IsDst(utcDateTime);

POSIX format

POSIX format lets you define all time zone's details in a compact string. For example "CET-1CEST,M3.5.0,M10.5.0/3" means:

  • Standard time name: CET
  • UTC offset: -1 hour
  • DST time name: CEST
  • DST starts on the last (5) Sunday (0) of March (3) at 2:00 AM (/3)
  • DST ends on the last (5) Sunday (0) of October (10) at 3:00 AM (/3)

Use TimeZoneConverter to parse POSIX string into TimeZone object and vice versa

var timezone = TimeZoneConverter.FromPosixString(posixString);
Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.51.19445 289 9/27/2025
1.0.50.57396 248 7/8/2025
1.0.49.8582 302 4/23/2025
1.0.48.54941 315 4/17/2025
1.0.47.64325 288 4/2/2025
1.0.46.34047 283 3/20/2025
1.0.45.55993 320 3/10/2025
1.0.44.10099 340 3/3/2025
1.0.42.58505 244 2/27/2025
1.0.41.1355 240 2/20/2025
1.0.40.50276 240 2/18/2025
1.0.39.17935 235 2/5/2025
1.0.38.33651 215 11/27/2024
1.0.37.28705 232 11/26/2024
1.0.36.39232 236 11/25/2024
1.0.35.38117 235 11/19/2024
1.0.34.62093 230 10/31/2024
1.0.33.4058 278 10/18/2024
1.0.32.53729 223 10/16/2024
1.0.31.59815 233 9/30/2024
Loading failed