Noda Time is a .NET library designed to simplify the correct handling of dates and times in the .NET environment.
Noda Time is an alternative date and time API for .NET. It helps you to think about your data more clearly, and express operations on that data more precisely.
It borrows many concepts from Joda Time, the industry standard date and time handling library for Java. It is an idiomatic port - not a direct translation. It has been specifically tailored for use in the .Net Framework.
There are many reasons to use Noda Time instead of the normal BCL date and time types, including:
Support for IANA/Olson time zones such as
America/New_York
.Distinct representations of different concepts: Instead of using
DateTime
to represent everything, there are different types for dates, times, values with time zones, values with just UTC offsets, etc.Reduced surprise: All Noda Time types work consistently in a predictable manner. By contrast, the
DateTime
type has different behaviors depending on itsKind
property. For examples of the type of surprises that are avoided, read "What's Wrong with DateTime Anyway?"Testability: You can easily mock the system clock using the
IClock
interface, and you have to go out of your way if you want to be affected by the computer's local time zone. By contrast,DateTime.Now
is difficult to mock, and is bound to the system time zone by default.
Noda Time also has the ability to work with Windows time zones, and can convert between them. It also contains zone.tab data, which can be used to correlate time zones with a country code, or locate time zones on a map.
Resources:
The primary author of Noda Time is Jon Skeet, of Stack Overflow fame.
See also: jodatime