Robo.Humanizer.Core
8.0.2
See the version list below for details.
dotnet add package Robo.Humanizer.Core --version 8.0.2
NuGet\Install-Package Robo.Humanizer.Core -Version 8.0.2
<PackageReference Include="Robo.Humanizer.Core" Version="8.0.2" />
paket add Robo.Humanizer.Core --version 8.0.2
#r "nuget: Robo.Humanizer.Core, 8.0.2"
// Install Robo.Humanizer.Core as a Cake Addin #addin nuget:?package=Robo.Humanizer.Core&version=8.0.2 // Install Robo.Humanizer.Core as a Cake Tool #tool nuget:?package=Robo.Humanizer.Core&version=8.0.2
Humanizer.Robo.Core
A collection of common helper methods for developers, including string manipulation, date formatting, and more.
Features
DateTimeExtensions - Helper Methods for DateTime Operations
This DateTimeExtensions
class provides a collection of useful extension methods for the DateTime
structure in C#. It includes basic date calculations, formatting, and advanced date/time operations. The following is an overview of the available methods along with descriptions of how they can be used in your projects.
Table of Contents
Basic Extensions
1. Add Business Days
This method adds a specified number of business days (Monday to Friday) to a DateTime
, skipping weekends (Saturday and Sunday).
2. Convert DateTime to Unix Timestamp
This method converts a DateTime
to a Unix timestamp, which is the number of seconds that have passed since January 1, 1970 (the Unix epoch).
3. Convert Unix Timestamp to DateTime
This method converts a Unix timestamp (seconds since 1970) back into a DateTime
object.
4. Convert DateTime to Short Date String
This method converts a DateTime
to a short date string format (e.g., "MM/dd/yyyy").
5. Convert DateTime to Long Date String
This method converts a DateTime
to a long date string format (e.g., "Saturday, November 30, 2024").
Advanced DateTime Calculations
6. Get ISO 8601 Week Number
This method returns the ISO 8601 week number for the given DateTime
.
7. Check if Dates are in the Same Month/Year
This method checks whether two DateTime
objects fall in the same month and year.
8. Get the Number of Days in the Month
This method returns the total number of days in the month of the given DateTime
.
9. Get the Fiscal Quarter of the Year
This method calculates the fiscal quarter of the year for the given DateTime
(1-4).
10. Get the Next Weekday
This method returns the next weekday after the given DateTime
, ignoring weekends (Saturday and Sunday).
Additional DateTime Extensions
11. Get the Weekdays Difference
This method calculates the number of weekdays (Monday to Friday) between two DateTime
objects, excluding weekends.
12. Check for Holidays
This method checks if a DateTime
falls on a public holiday (e.g., New Year's Day, Christmas).
13. Add Business Hours
This method adds a specified number of business hours (typically between 9:00 AM and 6:00 PM) to the given DateTime
, considering weekends.
14. Get the End of the Day
This method returns the end of the day (23:59:59.999) for a given DateTime
.
Installation
You can install this package using NuGet:
dotnet add package Humanizer.Robo.Core --version 1.0.0
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.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.
Version | Downloads | Last updated |
---|---|---|
8.0.5 | 86 | 11/30/2024 |
8.0.4 | 88 | 11/30/2024 |
8.0.3 | 87 | 11/30/2024 |
8.0.2 | 84 | 11/30/2024 |
8.0.1 | 88 | 11/30/2024 |
8.0.0 | 86 | 11/30/2024 |
1.0.9 | 85 | 11/30/2024 |
1.0.8 | 81 | 11/30/2024 |
1.0.7 | 96 | 11/29/2024 |
1.0.6 | 82 | 11/29/2024 |
1.0.5 | 78 | 11/29/2024 |
1.0.4 | 74 | 11/29/2024 |
1.0.3 | 83 | 11/29/2024 |
1.0.2 | 86 | 11/29/2024 |
1.0.1 | 85 | 11/29/2024 |
1.0.0 | 87 | 11/29/2024 |