https://github.com/FluentDateTime/FluentDateTime
Allows cleaner DateTime expressions and operations
https://github.com/FluentDateTime/FluentDateTime
Last synced: about 1 month ago
JSON representation
Allows cleaner DateTime expressions and operations
- Host: GitHub
- URL: https://github.com/FluentDateTime/FluentDateTime
- Owner: FluentDateTime
- License: mit
- Created: 2012-08-05T11:36:07.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2025-03-12T21:38:27.000Z (about 1 month ago)
- Last Synced: 2025-03-12T22:28:55.435Z (about 1 month ago)
- Language: C#
- Homepage:
- Size: 914 KB
- Stars: 695
- Watchers: 23
- Forks: 61
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
Awesome Lists containing this project
- awesome - FluentDateTime/FluentDateTime - Allows cleaner DateTime expressions and operations (C\#)
- awesome-dotnet-core - FluentDateTime - Allows you to write cleaner DateTime expressions and operation. Partially inspired by Ruby DateTime Extensions. (Frameworks, Libraries and Tools / Date and Time)
- fucking-awesome-dotnet-core - FluentDateTime - Allows you to write cleaner DateTime expressions and operation. Partially inspired by Ruby DateTime Extensions. (Frameworks, Libraries and Tools / Date and Time)
- awesome-dotnet-core - FluentDateTime - Allows you to write cleaner DateTime expressions and operation. Partially inspired by Ruby DateTime Extensions. (Frameworks, Libraries and Tools / Date and Time)
- awesome-dotnet-core - FluentDateTime - 允许您编写更清晰的DateTime表达式和操作。部分灵感来自Ruby DateTime Extensions。 (框架, 库和工具 / 日期和时间)
README
#
FluentDateTime
[](https://ci.appveyor.com/project/SimonCropp/fluentdatetime)
[](https://www.nuget.org/packages/FluentDateTime/)Allows cleaner DateTime expressions and operations.
**See [Milestones](../../milestones?state=closed) for release notes.**
Inspired by Ruby DateTime Extensions
* [Extensions To Datetime](http://edgeguides.rubyonrails.org/active_support_core_extensions.html#extensions-to-datetime)
* [Extensions To Time](http://edgeguides.rubyonrails.org/active_support_core_extensions.html#extensions-to-time)## NuGet
https://nuget.org/packages/FluentDateTime/
## Usage
Here is some examples of use cases
```csharp
// DateTime operations
DateTime.Now - 1.Weeks() - 3.Days() + 14.Minutes()
DateTime.Now + 5.Years()// Relative DateTime evaluations
3.Days().Ago()
2.Days().Since(DateTime.Now)// Fluent DateTime estimations
DateTime.Now.NextDay()
DateTime.Now.NextYear()
DateTime.Now.PreviousYear()
DateTime.Now.WeekAfter()
DateTime.Now.Midnight()
DateTime.Now.Noon()// Current DateTime manipulation
DateTime.Now.SetTime(11, 55, 0)// DateTime expressions
2022.Mar(23) // (implicitly convertible to DateTime and DateTimeOffset)
2022.March(23).At(10, 26)
```_See [Unit Tests](https://github.com/FluentDateTime/FluentDateTime/tree/master/src/Tests) in the project for more details._
## Icon
[Calendar](http://thenounproject.com/noun/calendar/#icon-No404) from The Noun Project