Soenneker.Utils.DateTime
11.0.1527
Prefix Reserved
dotnet add package Soenneker.Utils.DateTime --version 11.0.1527
NuGet\Install-Package Soenneker.Utils.DateTime -Version 11.0.1527
<PackageReference Include="Soenneker.Utils.DateTime" Version="11.0.1527" />
<PackageVersion Include="Soenneker.Utils.DateTime" Version="11.0.1527" />
<PackageReference Include="Soenneker.Utils.DateTime" />
paket add Soenneker.Utils.DateTime --version 11.0.1527
#r "nuget: Soenneker.Utils.DateTime, 11.0.1527"
#:package Soenneker.Utils.DateTime@11.0.1527
#addin nuget:?package=Soenneker.Utils.DateTime&version=11.0.1527
#tool nuget:?package=Soenneker.Utils.DateTime&version=11.0.1527
Soenneker.Utils.DateTime
Static helpers for constructing UTC timestamps and splitting ranges into timezone-aligned weeks or months.
Installation
dotnet add package Soenneker.Utils.DateTime
Construct timestamps
CreateUtcDateTime() builds a UTC DateTime. Any omitted component is taken from one snapshot of DateTime.UtcNow:
DateTime start = DateTimeUtil.CreateUtcDateTime(
year: 2026,
month: 4,
day: 15,
hour: 9,
minute: 30,
second: 0);
CreateTzDateTime() interprets the components as wall-clock time in a timezone and returns the corresponding UTC instant:
TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById("America/Chicago");
DateTime utc = DateTimeUtil.CreateTzDateTime(
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<(DateTime startAt, DateTime endAt)> weeks =
DateTimeUtil.GetWeeklyDateTimesBetween(startAt, endAt, zone);
List<(DateTime startAt, DateTime endAt)> months =
DateTimeUtil.GetMonthlyDateTimesBetween(startAt, endAt, zone);
Each method first expands startAt to the timezone-aligned start and end of its containing calendar period, then adds complete periods until one contains endAt. 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, including when endAt is earlier than that period's end. Validate range ordering before calling when an inverted range should be rejected.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Extensions.DateTime.Month (>= 11.0.1815)
- Soenneker.Extensions.DateTime.Week (>= 11.0.1678)
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 |
|---|---|---|
| 11.0.1527 | 0 | 11/15/2026 |
| 11.0.1526 | 40 | 11/14/2026 |
| 11.0.1525 | 151 | 11/11/2026 |
| 11.0.1522 | 65 | 11/11/2026 |
| 11.0.1521 | 53 | 11/11/2026 |
| 11.0.1520 | 52 | 11/11/2026 |
| 11.0.1519 | 57 | 11/11/2026 |
| 11.0.1518 | 100 | 11/11/2026 |
| 11.0.1516 | 81 | 11/11/2026 |
| 11.0.1515 | 349 | 11/3/2026 |
| 11.0.1514 | 96 | 11/3/2026 |
| 11.0.1513 | 100 | 11/3/2026 |
| 11.0.1512 | 95 | 11/3/2026 |
| 11.0.1511 | 368 | 10/27/2026 |
| 11.0.1510 | 103 | 10/27/2026 |
| 11.0.1509 | 146 | 10/26/2026 |
| 11.0.1508 | 105 | 10/26/2026 |
| 11.0.1506 | 117 | 10/26/2026 |
| 11.0.1505 | 96 | 10/26/2026 |
| 11.0.1504 | 95 | 10/26/2026 |
Update dependency Soenneker.Extensions.DateTime.Week to 11.0.1678 (#1516)