Soenneker.Extensions.DateTime
4.0.1777
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Extensions.DateTime --version 4.0.1777
NuGet\Install-Package Soenneker.Extensions.DateTime -Version 4.0.1777
<PackageReference Include="Soenneker.Extensions.DateTime" Version="4.0.1777" />
<PackageVersion Include="Soenneker.Extensions.DateTime" Version="4.0.1777" />
<PackageReference Include="Soenneker.Extensions.DateTime" />
paket add Soenneker.Extensions.DateTime --version 4.0.1777
#r "nuget: Soenneker.Extensions.DateTime, 4.0.1777"
#:package Soenneker.Extensions.DateTime@4.0.1777
#addin nuget:?package=Soenneker.Extensions.DateTime&version=4.0.1777
#tool nuget:?package=Soenneker.Extensions.DateTime&version=4.0.1777
Soenneker.Extensions.DateTime
A collection of helpful DateTime extension methods.
Installation
dotnet add package Soenneker.Extensions.DateTime
Quick start
using Soenneker.Extensions.DateTime;
DateTime utcTime = DateTime.UtcNow;
var result = utcTime.ToTz(tzInfo);
Common operations
ToTz()- Converts a UTCDateTimeto the specified time zone and then adjusts the result to UTC. This method is intended for scenarios where a UTC time needs to be converted to a specific time zone and then treated as if the converted time is in UTC.ToUtc()- Converts aSystem.DateTimevalue to Coordinated Universal Time (UTC) from a specified time zone, treating the original DateTime's kind as Unspecified. This method is useful when you have a DateTime value with a specific time zone and need to convert it to UTC, but the source DateTime's kind property is not Unspecified.ToAge()- Calculates the age in hours between the specified date and the current date and time. Returns the age in hours.QuartersBetween()- Returns the non-negative number of calendar quarters between two values, including fractional progress through the next quarter. Argument order does not matter.YearsBetween()- Returns the non-negative number of calendar years between two values, including fractional progress through the next year. Argument order does not matter.MonthsBetween()- Returns the non-negative number of calendar months between two values, including fractional progress through the next month. Argument order does not matter.WholeMonthsBetween()- Returns only fully completed calendar months; partial months are discarded and argument order does not matter.WholeYearsBetween()- Returns only fully completed calendar years; partial years are discarded and argument order does not matter.WholeQuartersBetween()- Returns only fully completed three-month quarters; partial quarters are discarded and argument order does not matter.Trim()- Trims aSystem.DateTimeobject to a specified level of precision. Returns a newSystem.DateTimeobject trimmed to the specifiedunitOfTime.TrimEnd()- Adjusts the providedSystem.DateTimeobject to the end of the specified period, minus one tick. Returns a newSystem.DateTimeobject representing the last moment of the specified period, just before it transitions to the next period, according to the specifiedunitOfTime.Add()- Adds a specified amount of time to the givenSystem.DateTimeobject based on the providedUnitOfTime. Returns a newSystem.DateTimeobject that is the result of adding the specified amount of time to the original date and time.
The package also includes 28 additional operations for more specialized cases.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Soenneker.Enums.UnitOfTime (>= 4.0.597)
- Soenneker.Extensions.TimeZoneInfos (>= 4.0.16)
NuGet packages (12)
Showing the top 5 NuGet packages that depend on Soenneker.Extensions.DateTime:
| Package | Downloads |
|---|---|
|
Soenneker.Extensions.DateTime.Day
A collection of helpful DateTime day-based extension methods |
|
|
Soenneker.Extensions.DateTime.Month
A collection of helpful DateTime month-based extension methods |
|
|
Soenneker.Extensions.DateTime.Week
A collection of helpful DateTime week-based extension methods |
|
|
Soenneker.GitHub.Repositories.PullRequests
Retrieves, reviews, rebases, and merges GitHub pull requests across repositories |
|
|
Soenneker.Extensions.DateTime.Quarter
A collection of helpful DateTime quarter (year) based extension methods |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1788 | 0 | 9/1/2026 |
| 4.0.1787 | 34 | 8/31/2026 |
| 4.0.1786 | 106 | 8/31/2026 |
| 4.0.1785 | 116 | 8/31/2026 |
| 4.0.1784 | 27 | 8/31/2026 |
| 4.0.1783 | 222 | 8/31/2026 |
| 4.0.1782 | 341 | 8/30/2026 |
| 4.0.1781 | 446 | 8/30/2026 |
| 4.0.1780 | 72 | 8/30/2026 |
| 4.0.1779 | 205 | 8/29/2026 |
| 4.0.1778 | 309 | 8/29/2026 |
| 4.0.1777 | 48 | 8/29/2026 |
| 4.0.1776 | 226 | 8/29/2026 |
| 4.0.1775 | 1,214 | 8/25/2026 |
| 4.0.1774 | 1,425 | 8/21/2026 |
| 4.0.1773 | 1,233 | 8/18/2026 |
| 4.0.1772 | 368 | 8/18/2026 |
| 4.0.1771 | 2,731 | 8/7/2026 |
| 4.0.1770 | 1,946 | 7/28/2026 |
| 4.0.1769 | 328 | 7/28/2026 |
Update dependency Soenneker.Extensions.TimeZoneInfos to 4.0.16 (#2153)