Soenneker.Extensions.DateTime.Month 11.0.1815

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

Computes current, previous, and next calendar-month boundaries for DateTime, with optional time-zone-aware UTC results.

Installation

dotnet add package Soenneker.Extensions.DateTime.Month

Calendar-field boundaries

using Soenneker.Extensions.DateTime.Month;

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

System.DateTime start = value.ToStartOfMonth();
System.DateTime end = value.ToEndOfMonth();
System.DateTime previousStart = value.ToStartOfPreviousMonth();
System.DateTime nextEnd = value.ToEndOfNextMonth();
Method Result
ToStartOfMonth() First tick of the current month
ToEndOfMonth() Last tick before the next month
ToStartOfPreviousMonth() First tick of the previous month
ToEndOfPreviousMonth() Last tick before the current month
ToStartOfNextMonth() First tick of the next month
ToEndOfNextMonth() Last tick before the month after next

These methods operate on the existing calendar fields, handle varying month lengths and leap years through DateTime calendar arithmetic, and preserve the input 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 localMonthStartUtc = utc.ToStartOfTzMonth(eastern);
System.DateTime localMonthEndUtc = utc.ToEndOfTzMonth(eastern);

The time-zone variants select the current, previous, or next month from the input instant's local calendar and return its boundary as a UTC DateTime:

  • ToStartOfTzMonth() / ToEndOfTzMonth()
  • ToStartOfPreviousTzMonth() / ToEndOfPreviousTzMonth()
  • ToStartOfNextTzMonth() / ToEndOfNextTzMonth()

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.

Month ends are defined as one tick before the following valid local month boundary. If a local month begins in a daylight-saving gap, the boundary advances to the first valid local minute; if it is ambiguous, the earlier UTC instant is selected.

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

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.1815 41 11/14/2026
11.0.1814 336 11/11/2026
11.0.1813 84 11/11/2026
11.0.1812 100 11/11/2026
11.0.1811 96 11/11/2026
11.0.1810 94 11/11/2026
11.0.1809 108 11/11/2026
11.0.1808 80 11/11/2026
11.0.1807 104 11/11/2026
11.0.1806 144 11/11/2026
11.0.1805 100 11/10/2026
11.0.1804 74 11/10/2026
11.0.1803 788 11/3/2026
11.0.1801 181 11/3/2026
11.0.1800 611 10/27/2026
11.0.1799 154 10/26/2026
11.0.1798 113 10/26/2026
11.0.1797 113 10/26/2026
11.0.1796 130 10/26/2026
11.0.1795 100 10/26/2026
Loading failed

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