DateAndTimeExtensions 1.1.0
See the version list below for details.
dotnet add package DateAndTimeExtensions --version 1.1.0
NuGet\Install-Package DateAndTimeExtensions -Version 1.1.0
<PackageReference Include="DateAndTimeExtensions" Version="1.1.0" />
paket add DateAndTimeExtensions --version 1.1.0
#r "nuget: DateAndTimeExtensions, 1.1.0"
// Install DateAndTimeExtensions as a Cake Addin #addin nuget:?package=DateAndTimeExtensions&version=1.1.0 // Install DateAndTimeExtensions as a Cake Tool #tool nuget:?package=DateAndTimeExtensions&version=1.1.0
DateAndTimeExtensions (C#)
Available via Nuget: https://www.nuget.org/packages/DateAndTimeExtensions
Little convenience helper extension methods for:
DateTime
DateOnly
TimeOnly
There are 2 type of extensions:
- instance (parameter
this
) - class
However, C# unfortunately doesn't allow to extend static classes themselves.
This is why you need to call DateTimeExt
, DateOnlyExt
or TimeOnlyExt
for the class variants (no this
parameter).
If the classes would be named like their .NET counterparts you would have to constantly fully qualify the namespace which would be cumbersome.
Extension methods
DateTime
- DaysFromNow(this DateTime dateTime):int
- DaysFromToday(this DateTime dateTime):int
- DaysFromUtcNow(this DateTime dateTime):int
- DaysSinceNow(this DateTime dateTime):int
- DaysSinceToday(this DateTime dateTime):int
- DaysSinceUtcNow(this DateTime dateTime):int
- EndOfDay(this DateTime dateTime):DateTime
- EndOfMonth():DateTime
- EndOfMonth(this DateTime dateTime):DateTime
- EndOfToday():DateTime
- EndOfYear():DateTime
- EndOfYear(this DateTime dateTime):DateTime
- IsWeekday():bool
- IsWeekday(this DateTime dateTime):bool
- IsWeekend():bool
- IsWeekend(this DateTime dateTime):bool
- LastOfMonth():DateTime
- LastOfMonth(this DateTime dateTime):DateTime
- LastOfYear():DateTime
- LastOfYear(this DateTime dateTime):DateTime
- NextWorkday():DateTime
- NextWorkday(this DateTime dateTime):DateTime
- PreviousWorkday():DateTime
- PreviousWorkday(this DateTime dateTime):DateTime
- SetTime(this DateTime dateTime, int hours, int minutes = 0, int seconds = 0, int milliseconds = 0):DateTime
- StartOfDay(this DateTime dateTime):DateTime
- StartOfMonth():DateTime
- StartOfMonth(this DateTime dateTime):DateTime
- StartOfYear():DateTime
- StartOfYear(this DateTime dateTime):DateTime
- Tomorrow():DateTime
- TomorrowFromNow():DateTime
- TomorrowFromUtcNow():DateTime
- Yesterday():DateTime
- YesterdayFromNow():DateTime
- YesterdayFromUtcNow():DateTime
DateOnly
- DaysFromToday(this DateOnly dateOnly):int
- DaysSinceToday(this DateOnly dateOnly):int
- FirstOfMonth():DateOnly
- FirstOfMonth(this DateOnly dateOnly):DateOnly
- FirstOfYear():DateOnly
- FirstOfYear(this DateOnly dateOnly):DateOnly
- IsWeekday():bool
- IsWeekday(this DateOnly dateOnly):bool
- IsWeekend():bool
- IsWeekend(this DateOnly dateOnly):bool
- LastOfMonth():DateOnly
- LastOfMonth(this DateOnly dateOnly):DateOnly
- LastOfYear():DateOnly
- LastOfYear(this DateOnly dateOnly):DateOnly
- NextWorkday():DateOnly
- NextWorkday(this DateOnly dateOnly):DateOnly
- PreviousWorkday():DateOnly
- PreviousWorkday(this DateOnly dateOnly):DateOnly
- Today():DateOnly
- Tomorrow():DateOnly
- Yesterday():DateOnly
TimeOnly
- Midday():TimeOnly
- Now():TimeOnly
- UtcNow():TimeOnly
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
See https://github.com/db2222/DateAndTimeExtensions/releases for the changes.