Soenneker.Extensions.DateTime.Week 11.0.1685

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

Computes Monday-based week boundaries and ISO-8601 week numbers for DateTime, with optional time-zone-aware UTC results.

Installation

dotnet add package Soenneker.Extensions.DateTime.Week

Week boundaries

using Soenneker.Extensions.DateTime.Week;

System.DateTime value = new(2026, 8, 29, 16, 42, 30, DateTimeKind.Utc);

System.DateTime start = value.ToStartOfWeek();
System.DateTime end = value.ToEndOfWeek();
System.DateTime previousStart = value.ToStartOfPreviousWeek();
System.DateTime nextEnd = value.ToEndOfNextWeek();

Weeks always begin Monday at 00:00:00; they do not depend on the current culture. End methods return one tick before the following Monday.

Method pair Selected week
ToStartOfWeek() / ToEndOfWeek() Current
ToStartOfPreviousWeek() / ToEndOfPreviousWeek() Previous
ToStartOfNextWeek() / ToEndOfNextWeek() Next

These methods operate on the input calendar fields and preserve Kind. They do not perform time-zone conversion.

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 localWeekStartUtc = utc.ToStartOfTzWeek(eastern);
System.DateTime localWeekEndUtc = utc.ToEndOfTzWeek(eastern);

Time-zone variants cover the current, previous, and next local week and return boundaries as UTC DateTime values. Their names follow the same pattern, including ToStartOfPreviousTzWeek() and ToEndOfNextTzWeek().

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.

Week ends are one tick before the following valid local Monday boundary. If local Monday midnight falls in a daylight-saving gap, the boundary advances to the first valid local minute; if it is ambiguous, the earlier UTC instant is selected.

ISO week numbers

int utcWeek = utc.ToUtcWeekNumber();
int easternWeek = utc.ToTzWeekNumber(eastern);

Both methods use ISO-8601 rules: Monday is the first weekday, and week 1 is the week containing January 4. ToUtcWeekNumber() applies those rules to the input date fields without converting them. ToTzWeekNumber() first selects the calendar date in the supplied time zone.

Only the week number (1–53) is returned. If the associated ISO week-year is also required, use System.Globalization.ISOWeek.GetYear() on the same calendar date.

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 (2)

Showing the top 2 NuGet packages that depend on Soenneker.Extensions.DateTime.Week:

Package Downloads
Soenneker.Extensions.DateTime.Suite

A collection of all the DateTime precision extension methods

Soenneker.Utils.DateTime

A utility library for helpful DateTime related operations

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.1685 171 11/19/2026
11.0.1683 132 11/18/2026
11.0.1681 128 11/18/2026
11.0.1679 183 11/15/2026
11.0.1678 147 11/14/2026
11.0.1677 252 11/11/2026
11.0.1676 107 11/11/2026
11.0.1675 130 11/11/2026
11.0.1673 150 11/11/2026
11.0.1672 146 11/11/2026
11.0.1671 102 11/11/2026
11.0.1670 119 11/11/2026
11.0.1669 158 11/10/2026
11.0.1668 101 11/10/2026
11.0.1667 528 11/3/2026
11.0.1666 161 11/3/2026
11.0.1665 128 11/3/2026
11.0.1664 230 10/27/2026
11.0.1663 165 10/26/2026
11.0.1662 110 10/26/2026
Loading failed

Updated Soenneker.Extensions.DateTime to 11.0.1867