Soenneker.Utils.DateTimeOffsets 4.0.230

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Utils.DateTimeOffsets --version 4.0.230
                    
NuGet\Install-Package Soenneker.Utils.DateTimeOffsets -Version 4.0.230
                    
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="Soenneker.Utils.DateTimeOffsets" Version="4.0.230" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.DateTimeOffsets" Version="4.0.230" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.DateTimeOffsets" />
                    
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 Soenneker.Utils.DateTimeOffsets --version 4.0.230
                    
#r "nuget: Soenneker.Utils.DateTimeOffsets, 4.0.230"
                    
#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 Soenneker.Utils.DateTimeOffsets@4.0.230
                    
#: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=Soenneker.Utils.DateTimeOffsets&version=4.0.230
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.DateTimeOffsets&version=4.0.230
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Utils.DateTimeOffsets

Static helpers for constructing UTC DateTimeOffset values and splitting ranges into timezone-aligned weeks or months.

Installation

dotnet add package Soenneker.Utils.DateTimeOffsets

Construct timestamps

CreateUtcDateTimeOffset() builds a value with a zero UTC offset. Any omitted component is taken from one snapshot of DateTimeOffset.UtcNow:

DateTimeOffset start = DateTimeOffsetsUtil.CreateUtcDateTimeOffset(
    year: 2026,
    month: 4,
    day: 15,
    hour: 9,
    minute: 30,
    second: 0);

CreateTzDateTimeOffset() interprets the components as wall-clock time in a timezone and returns the corresponding instant with a zero UTC offset:

TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById("America/Chicago");

DateTimeOffset utc = DateTimeOffsetsUtil.CreateTzDateTimeOffset(
    zone,
    year: 2026,
    month: 4,
    day: 15,
    hour: 9,
    minute: 30,
    second: 0);

Omitted components use the current wall-clock values in that timezone. Standard TimeZoneInfo rules apply: invalid local times during a daylight-saving transition throw, and ambiguous local times use the platform's normal conversion behavior.

Calendar ranges

List<(DateTimeOffset startAt, DateTimeOffset endAt)> weeks =
    DateTimeOffsetsUtil.GetWeeklyDateTimeOffsetsBetween(startAt, endAt, zone);

List<(DateTimeOffset startAt, DateTimeOffset endAt)> months =
    DateTimeOffsetsUtil.GetMonthlyDateTimeOffsetsBetween(startAt, endAt, zone);

Each method first expands startAt to the timezone-aligned start and end of its containing calendar period, then adds complete local-calendar periods until one contains endAt. Results are UTC instants, and their UTC boundary time can change across daylight-saving transitions while still representing the same local boundary.

The returned ranges are calendar buckets rather than intersections with the input range, so the first start may precede startAt and the final end may follow endAt. Both methods return at least the period containing startAt; validate range ordering before calling when an inverted range should be rejected.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
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
4.0.246 23 9/30/2026
4.0.245 30 9/30/2026
4.0.244 40 9/30/2026
4.0.243 110 9/25/2026
4.0.242 81 9/25/2026
4.0.241 81 9/24/2026
4.0.240 87 9/24/2026
4.0.239 228 9/16/2026
4.0.238 97 9/16/2026
4.0.237 97 9/16/2026
4.0.236 94 9/16/2026
4.0.235 87 9/16/2026
4.0.234 93 9/15/2026
4.0.233 95 9/13/2026
4.0.232 96 9/13/2026
4.0.231 92 9/13/2026
4.0.230 88 9/13/2026
4.0.229 99 9/12/2026
4.0.228 88 9/12/2026
4.0.227 101 9/10/2026
Loading failed

Updated Soenneker.Extensions.DateTimeOffsets.Suite to 4.0.506