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
                    
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.Extensions.DateTime.Day" Version="11.0.2080" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Extensions.DateTime.Day" Version="11.0.2080" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Extensions.DateTime.Day" />
                    
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.Extensions.DateTime.Day --version 11.0.2080
                    
#r "nuget: Soenneker.Extensions.DateTime.Day, 11.0.2080"
                    
#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.Extensions.DateTime.Day@11.0.2080
                    
#: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.Extensions.DateTime.Day&version=11.0.2080
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Extensions.DateTime.Day&version=11.0.2080
                    
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

alternate text is missing from this package README image 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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed

Update dependency Soenneker.Extensions.DateTime to 11.0.1859 (#2530)