You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project is a merge of several common DateTime operations on the form of extensions to System.DateTime, including natural date difference text (precise and human rounded), holidays and working days calculations on several culture locales.
DateTimeExtensions is a powerful C# library that extends the functionality of System.DateTime and System.DateTimeOffset. It provides useful methods for working with dates and times, making your code more expressive and easier to read.
β¨ Key Features
Working Days Calculations: Easily add or subtract working days, considering regional holidays.
Holiday Support: Includes holiday definitions for multiple cultures and regions.
Natural Language Date Differences: Get the difference between dates in human-readable format.
Time of Day Operations: Simplify time-based comparisons and checks.
Calendar Export: Export holidays to common calendar formats.
SourceLink Support: Enables debugging into the source code.
Here are some examples of what you can do with DateTimeExtensions:
usingDateTimeExtensions;// Add 5 working days to a dateDateTimefutureDate=DateTime.Now.AddWorkingDays(5);// Check if a date is a working dayboolisWorkingDay=DateTime.Now.IsWorkingDay();// Get the difference between dates in natural languagestringdateDiff=DateTime.Now.ToNaturalText(DateTime.Now.AddDays(45));// Check if a time is between two other timesboolisBetween=DateTime.Now.IsBetween(newTime("09:00"),newTime("17:00"));
π Supported Cultures
DateTimeExtensions supports working day and holiday calculations for many cultures, including:
United States (en-US)
United Kingdom (en-GB)
France (fr-FR)
Germany (de-DE)
Spain (es-ES)
Brazil (pt-BR)
Portugal (pt-PT)
and many more!
Don't see your culture? Contributions are welcome!
π§ Advanced Features
Exporting Holidays
You can export holidays to various calendar formats:
DateTimeExtensions: Making date and time operations in C# simpler and more intuitive.
About
This project is a merge of several common DateTime operations on the form of extensions to System.DateTime, including natural date difference text (precise and human rounded), holidays and working days calculations on several culture locales.