Soenneker.Extensions.DateTime 4.0.1777

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

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 UTC DateTime to 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 a System.DateTime value 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 a System.DateTime object to a specified level of precision. Returns a new System.DateTime object trimmed to the specified unitOfTime.
  • TrimEnd() - Adjusts the provided System.DateTime object to the end of the specified period, minus one tick. Returns a new System.DateTime object representing the last moment of the specified period, just before it transitions to the next period, according to the specified unitOfTime.
  • Add() - Adds a specified amount of time to the given System.DateTime object based on the provided UnitOfTime. Returns a new System.DateTime object 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed

Update dependency Soenneker.Extensions.TimeZoneInfos to 4.0.16 (#2153)