MakoIoT.Device.Utilities.TimeZones 1.0.19.41562

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.19.41562                
NuGet\Install-Package MakoIoT.Device.Utilities.TimeZones -Version 1.0.19.41562                
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.19.41562" />                
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.19.41562                
#r "nuget: MakoIoT.Device.Utilities.TimeZones, 1.0.19.41562"                
#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.19.41562

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

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.34.62093 61 10/31/2024
1.0.33.4058 110 10/18/2024
1.0.32.53729 64 10/16/2024
1.0.31.59815 78 9/30/2024
1.0.30.19105 78 9/26/2024
1.0.29.38441 86 9/20/2024
1.0.28.62450 99 9/12/2024
1.0.27.45223 110 9/5/2024
1.0.24.14493 97 8/29/2024
1.0.23.19968 105 8/10/2024
1.0.22.1635 91 6/12/2024
1.0.21.23332 110 5/18/2024
1.0.20.26245 114 5/17/2024
1.0.19.41562 118 4/9/2024
1.0.18.43931 106 4/8/2024
1.0.17.54206 97 4/3/2024
1.0.16.52448 105 3/21/2024
1.0.15.64645 157 1/16/2024
1.0.13.59166 113 1/11/2024
1.0.12.46577 136 1/11/2024
1.0.11.47189 185 11/10/2023
1.0.9.41101 184 5/25/2023
1.0.8.16939 165 5/25/2023