MakoIoT.Device.Utilities.TimeZones 1.0.28.62450

There is a newer version of this package available.
See the version list below for details.
dotnet add package MakoIoT.Device.Utilities.TimeZones --version 1.0.28.62450                
NuGet\Install-Package MakoIoT.Device.Utilities.TimeZones -Version 1.0.28.62450                
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.28.62450" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MakoIoT.Device.Utilities.TimeZones --version 1.0.28.62450                
#r "nuget: MakoIoT.Device.Utilities.TimeZones, 1.0.28.62450"                
#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.
// Install MakoIoT.Device.Utilities.TimeZones as a Cake Addin
#addin nuget:?package=MakoIoT.Device.Utilities.TimeZones&version=1.0.28.62450

// Install MakoIoT.Device.Utilities.TimeZones as a Cake Tool
#tool nuget:?package=MakoIoT.Device.Utilities.TimeZones&version=1.0.28.62450                

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.29.38441 22 9/20/2024
1.0.28.62450 65 9/12/2024
1.0.27.45223 81 9/5/2024
1.0.24.14493 72 8/29/2024
1.0.23.19968 88 8/10/2024
1.0.22.1635 73 6/12/2024
1.0.21.23332 94 5/18/2024
1.0.20.26245 96 5/17/2024
1.0.19.41562 104 4/9/2024
1.0.18.43931 87 4/8/2024
1.0.17.54206 81 4/3/2024
1.0.16.52448 87 3/21/2024
1.0.15.64645 140 1/16/2024
1.0.13.59166 95 1/11/2024
1.0.12.46577 121 1/11/2024
1.0.11.47189 169 11/10/2023
1.0.9.41101 166 5/25/2023
1.0.8.16939 146 5/25/2023