Soenneker.Extensions.DateTime.Day
11.0.2080
Prefix Reserved
dotnet add package Soenneker.Extensions.DateTime.Day --version 11.0.2080
NuGet\Install-Package Soenneker.Extensions.DateTime.Day -Version 11.0.2080
<PackageReference Include="Soenneker.Extensions.DateTime.Day" Version="11.0.2080" />
<PackageVersion Include="Soenneker.Extensions.DateTime.Day" Version="11.0.2080" />
<PackageReference Include="Soenneker.Extensions.DateTime.Day" />
paket add Soenneker.Extensions.DateTime.Day --version 11.0.2080
#r "nuget: Soenneker.Extensions.DateTime.Day, 11.0.2080"
#:package Soenneker.Extensions.DateTime.Day@11.0.2080
#addin nuget:?package=Soenneker.Extensions.DateTime.Day&version=11.0.2080
#tool nuget:?package=Soenneker.Extensions.DateTime.Day&version=11.0.2080
Soenneker.Extensions.DateTime.Day
Computes current, previous, and next day boundaries for DateTime, either from its existing clock fields or from a UTC instant in a specified time zone.
Installation
dotnet add package Soenneker.Extensions.DateTime.Day
Clock-field boundaries
using Soenneker.Extensions.DateTime.Day;
System.DateTime value = new(2026, 8, 29, 16, 42, 30, DateTimeKind.Utc);
System.DateTime start = value.ToStartOfDay();
System.DateTime end = value.ToEndOfDay();
System.DateTime previousStart = value.ToStartOfPreviousDay();
System.DateTime nextEnd = value.ToEndOfNextDay();
These methods do not perform a time-zone conversion. They operate on the date already present in the value and preserve its Kind.
| Method | Result |
|---|---|
ToStartOfDay() |
00:00:00 on the same date |
ToEndOfDay() |
One tick before the next date |
ToStartOfPreviousDay() |
00:00:00 on the previous date |
ToEndOfPreviousDay() |
One tick before the current date |
ToStartOfNextDay() |
00:00:00 on the next date |
ToEndOfNextDay() |
One tick before the date after next |
Time-zone-aware boundaries
TimeZoneInfo eastern = TimeZoneInfo.FindSystemTimeZoneById("America/New_York");
System.DateTime utc = new(2026, 8, 29, 18, 0, 0, DateTimeKind.Utc);
System.DateTime localDayStartUtc = utc.ToStartOfTzDay(eastern);
System.DateTime localDayEndUtc = utc.ToEndOfTzDay(eastern);
The ...TzDay() methods use the supplied UTC clock fields to determine the corresponding local date, calculate that date's boundary in the target zone, and return the boundary as a UTC DateTime.
Available methods cover the start and end of the current, previous, and next local day:
ToStartOfTzDay()/ToEndOfTzDay()ToStartOfPreviousTzDay()/ToEndOfPreviousTzDay()ToStartOfNextTzDay()/ToEndOfNextTzDay()
If the input Kind is not Utc, its fields are treated as UTC rather than converted from the machine's local zone. Supply an actual UTC value to avoid ambiguity.
Day boundaries use local calendar math rather than fixed 24-hour durations. If local midnight falls in a daylight-saving gap, the start advances to the first valid local minute. If it is ambiguous, the earlier UTC instant is selected. An end boundary is one tick before the following valid day boundary, so 23-hour, 25-hour, and skipped local dates are handled consistently.
Day-of-week mapping
DayOfWeekType day = value.ToDayOfWeekType();
ToDayOfWeekType() maps System.DayOfWeek directly to the corresponding Soenneker.Enums.DayOfWeek.DayOfWeekType; it performs no time-zone conversion.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Enums.DayOfWeek (>= 11.0.806)
- Soenneker.Extensions.DateTime (>= 11.0.1859)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Extensions.DateTime.Day:
| Package | Downloads |
|---|---|
|
Soenneker.Extensions.DateTime.DayOfWeek
A collection of helpful DateTime day of week based extension methods |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.2080 | 50 | 11/14/2026 |
| 11.0.2079 | 58 | 11/14/2026 |
| 11.0.2078 | 196 | 11/11/2026 |
| 11.0.2077 | 99 | 11/11/2026 |
| 11.0.2076 | 89 | 11/11/2026 |
| 11.0.2075 | 95 | 11/11/2026 |
| 11.0.2073 | 138 | 11/11/2026 |
| 11.0.2072 | 87 | 11/11/2026 |
| 11.0.2071 | 98 | 11/11/2026 |
| 11.0.2070 | 103 | 11/11/2026 |
| 11.0.2069 | 91 | 11/10/2026 |
| 11.0.2068 | 78 | 11/10/2026 |
| 11.0.2067 | 649 | 11/3/2026 |
| 11.0.2066 | 115 | 11/3/2026 |
| 11.0.2065 | 126 | 11/2/2026 |
| 11.0.2064 | 224 | 10/27/2026 |
| 11.0.2063 | 97 | 10/27/2026 |
| 11.0.2062 | 154 | 10/26/2026 |
| 11.0.2061 | 120 | 10/26/2026 |
| 11.0.2059 | 119 | 10/26/2026 |
Update dependency Soenneker.Extensions.DateTime to 11.0.1859 (#2530)