Soenneker.Extensions.DateTime.DayOfWeek 11.0.1555

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

Moves a DateTime to the strictly previous or next occurrence of a weekday, with optional day boundaries and time-zone-aware UTC results.

Installation

dotnet add package Soenneker.Extensions.DateTime.DayOfWeek
using Soenneker.Extensions.DateTime.DayOfWeek;

System.DateTime monday = new(2026, 8, 31, 15, 30, 0, DateTimeKind.Utc);

System.DateTime previousFriday = monday.ToPreviousDayOfWeek(DayOfWeek.Friday);
System.DateTime nextMonday = monday.ToNextDayOfWeek(DayOfWeek.Monday);

Navigation is strict. If the input is already on the requested weekday, the previous/next result is seven days away. ToPreviousDayOfWeek() and ToNextDayOfWeek() preserve the time of day and Kind.

Use the boundary variants when the clock fields should be reset:

System.DateTime previousFridayStart = monday.ToStartOfPreviousDayOfWeek(DayOfWeek.Friday);
System.DateTime nextFridayEnd = monday.ToEndOfNextDayOfWeek(DayOfWeek.Friday);

Start methods return local clock midnight. End methods return one tick before the following date. These non-time-zone methods operate directly on the input fields and preserve Kind.

Time-zone-aware navigation

TimeZoneInfo eastern = TimeZoneInfo.FindSystemTimeZoneById("America/New_York");
System.DateTime utc = new(2026, 8, 29, 18, 0, 0, DateTimeKind.Utc);

System.DateTime nextMondayStartUtc =
    utc.ToStartOfNextTzDayOfWeek(DayOfWeek.Monday, eastern);

System.DateTime previousFridayEndUtc =
    utc.ToEndOfPreviousTzDayOfWeek(DayOfWeek.Friday, eastern);

The time-zone variants first determine the input instant's local weekday, select the strictly previous or next matching local date, and return its boundary as a UTC DateTime:

  • ToStartOfPreviousTzDayOfWeek()
  • ToStartOfNextTzDayOfWeek()
  • ToEndOfPreviousTzDayOfWeek()
  • ToEndOfNextTzDayOfWeek()

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.

Boundaries use local calendar math. A midnight in a daylight-saving gap advances to the first valid local minute; an ambiguous midnight selects the earlier UTC instant. End values are one tick before the next valid local day boundary.

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.DayOfWeek:

Package Downloads
Soenneker.Extensions.DateTime.Suite

A collection of all the DateTime precision extension methods

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.1555 69 12/3/2026
11.0.1554 69 12/3/2026
11.0.1553 53 12/3/2026
11.0.1552 66 12/3/2026
11.0.1551 63 12/3/2026
11.0.1550 68 12/2/2026
11.0.1549 60 12/2/2026
11.0.1548 67 12/2/2026
11.0.1547 60 12/2/2026
11.0.1546 52 12/2/2026
11.0.1545 96 12/2/2026
11.0.1544 135 12/1/2026
11.0.1543 108 12/1/2026
11.0.1542 123 12/1/2026
11.0.1541 84 12/1/2026
11.0.1540 128 11/30/2026
11.0.1539 92 11/30/2026
11.0.1538 118 11/30/2026
11.0.1537 220 11/19/2026
11.0.1536 155 11/18/2026
Loading failed

Updated Multiple NuGet packages