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
<PackageReference Include="Soenneker.Extensions.DateTime.Month" Version="11.0.1815" />
<PackageVersion Include="Soenneker.Extensions.DateTime.Month" Version="11.0.1815" />
<PackageReference Include="Soenneker.Extensions.DateTime.Month" />
paket add Soenneker.Extensions.DateTime.Month --version 11.0.1815
#r "nuget: Soenneker.Extensions.DateTime.Month, 11.0.1815"
#:package Soenneker.Extensions.DateTime.Month@11.0.1815
#addin nuget:?package=Soenneker.Extensions.DateTime.Month&version=11.0.1815
#tool nuget:?package=Soenneker.Extensions.DateTime.Month&version=11.0.1815
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Extensions.DateTime (>= 11.0.1859)
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 |
Update dependency Soenneker.Extensions.DateTime to 11.0.1859 (#2267)