Soenneker.Utils.DateTimeOffsets
4.0.230
Prefix Reserved
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
<PackageReference Include="Soenneker.Utils.DateTimeOffsets" Version="4.0.230" />
<PackageVersion Include="Soenneker.Utils.DateTimeOffsets" Version="4.0.230" />
<PackageReference Include="Soenneker.Utils.DateTimeOffsets" />
paket add Soenneker.Utils.DateTimeOffsets --version 4.0.230
#r "nuget: Soenneker.Utils.DateTimeOffsets, 4.0.230"
#:package Soenneker.Utils.DateTimeOffsets@4.0.230
#addin nuget:?package=Soenneker.Utils.DateTimeOffsets&version=4.0.230
#tool nuget:?package=Soenneker.Utils.DateTimeOffsets&version=4.0.230
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 | Versions 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. |
-
net10.0
- Soenneker.Extensions.DateTimeOffsets.Suite (>= 4.0.506)
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 |
Updated Soenneker.Extensions.DateTimeOffsets.Suite to 4.0.506