Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

NodaTime

Noda Time is a date and time API acting as an alternative to the built-in DateTime/DateTimeOffset etc types in .NET.

Author Jon Skeet
Version 3.3.0
Tags date time timezone calendar nodatime

Public Types

NodaTime

Exception thrown to indicate that the specified local date/time occurs twice in a particular time zone due to daylight saving time changes.
struct AnnualDate
Represents an annual date (month and day) in the ISO calendar but without a specific year, typically for recurrent events such as birthdays, anniversaries, and deadlines.
A calendar system maps the non-calendar-specific "local time line" to human concepts such as years, months and days.
Factory class for date adjusters: functions from <see cref="T:NodaTime.LocalDate" /> to <c>LocalDate</c> , which can be applied to <see cref="T:NodaTime.LocalDate" /> , <see cref="T:NodaTime.LocalDateTime" /> , and <see cref="T:NodaTime.OffsetDateTime" /> .
class DateInterval
An interval between two dates.
class DateTimeZone
Represents a time zone - a mapping between UTC and local time. A time zone maps UTC instants to local times - or, equivalently, to the offset from UTC at any particular instant.
Static access to date/time zone providers built into Noda Time and for global configuration where this is unavoidable. All properties are thread-safe, and the providers returned by the read-only properties cache their results.
struct Duration
Represents a fixed (and calendar-independent) length of time.
interface IClock
Represents a clock which can return the current time as an <see cref="T:NodaTime.Instant" /> .
Provides stable, performant time zone data.
struct Instant
Represents an instant on the global timeline, with nanosecond resolution.
struct Interval
An interval between two instants in time (start and end).
Equates the days of the week with their numerical value according to ISO-8601. This corresponds with System.DayOfWeek except for Sunday, which is 7 in the ISO numbering and 0 in System.DayOfWeek.
struct LocalDate
LocalDate is an immutable struct representing a date within the calendar, with no reference to a particular time zone or time of day.
struct LocalDateTime
A date and time in a particular calendar system. A LocalDateTime value does not represent an instant on the global time line, because it has no associated time zone: "November 12th 2009 7pm, ISO calendar" occurred at different instants for different people around the world.
struct LocalTime
LocalTime is an immutable struct representing a time of day, with no reference to a particular calendar, time zone or date.
Useful constants, mostly along the lines of "number of milliseconds in an hour".
struct Offset
An offset from UTC in seconds. A positive value means that the local time is ahead of UTC (e.g. for Europe); a negative value means that the local time is behind UTC (e.g. for America).
struct OffsetDate
A combination of a <see cref="T:NodaTime.LocalDate" /> and an <see cref="P:NodaTime.OffsetDate.Offset" /> , to represent a date at a specific offset from UTC but without any time-of-day information.
A local date and time in a particular calendar system, combined with an offset from UTC. This is broadly similar to <see cref="T:System.DateTimeOffset" /> in the BCL.
struct OffsetTime
A combination of a <see cref="T:NodaTime.LocalTime" /> and an <see cref="P:NodaTime.OffsetTime.Offset" /> , to represent a time-of-day at a specific offset from UTC but without any date information.
class Period
Represents a period of time expressed in human chronological terms: hours, days, weeks, months and so on.
A mutable builder class for <see cref="T:NodaTime.Period" /> values. Each property can be set independently, and then a Period can be created from the result using the <see cref="M:NodaTime.PeriodBuilder.Build" /> method.
The units within a <see cref="T:NodaTime.Period" /> . When a period is created to find the difference between two local values, the caller may specify which units are required - for example, you can ask for the difference between two dates in "years and weeks". Units are always applied largest-first in arithmetic.
Exception thrown to indicate that the specified local time doesn't exist in a particular time zone due to daylight saving time changes.
class SystemClock
Singleton implementation of <see cref="T:NodaTime.IClock" /> which reads the current system time. It is recommended that for anything other than throwaway code, this is only referenced in a single place in your code: where you provide a value to inject into the rest of your application, which should only depend on the interface.
Factory class for time adjusters: functions from <see cref="T:NodaTime.LocalTime" /> to <c>LocalTime</c> , which can be applied to <see cref="T:NodaTime.LocalTime" /> , <see cref="T:NodaTime.LocalDateTime" /> , and <see cref="T:NodaTime.OffsetDateTime" /> .
struct YearMonth
A year and month in a particular calendar. This is effectively <see cref="T:NodaTime.LocalDate" /> without the day-of-month component.
class ZonedClock
A clock with an associated time zone and calendar. This is effectively a convenience class decorating an <see cref="T:NodaTime.IClock" /> .
struct ZonedDateTime
A <see cref="T:NodaTime.LocalDateTime" /> in a specific time zone and with a particular offset to distinguish between otherwise-ambiguous instants. A <see cref="T:NodaTime.ZonedDateTime" /> is global, in that it maps to a single <see cref="T:NodaTime.Instant" /> .

NodaTime.​Calendars

class Era
Represents an era used in a calendar.
The month numbering to use for the Hebrew calendar.
The epoch to use when constructing an Islamic calendar.
The pattern of leap years to use when constructing an Islamic calendar.
interface IWeekYearRule
A rule determining how "week years" are arranged, including the weeks within the week year. Implementations provided by Noda Time itself can be obtained via the <see cref="T:NodaTime.Calendars.WeekYearRules" /> class.
Extension methods on <see cref="T:NodaTime.Calendars.IWeekYearRule" /> .
Factory methods to construct week-year rules supported by Noda Time.

NodaTime.​Extensions

Extension methods for <see cref="T:NodaTime.IClock" /> .
Extension methods for <see cref="T:System.DateOnly" /> .
Extension methods for <see cref="T:System.DateTime" /> .
Extension methods for <see cref="T:System.DateTimeOffset" /> .
Extensions for <see cref="T:NodaTime.IDateTimeZoneProvider" />
Extension methods for <see cref="T:System.DayOfWeek" /> .
Extension methods
Extension methods for <see cref="T:System.Diagnostics.Stopwatch" /> .
Extension methods for <see cref="T:System.TimeOnly" /> .
Extension methods for <see cref="T:System.TimeProvider" /> .
Extension methods for <see cref="T:System.TimeSpan" /> .

NodaTime.​HighPerformance

struct Duration64
Represents a fixed (and calendar-independent) length of time. This type is a equivalent to <see cref="T:NodaTime.Duration" /> , but with a more limited range (a few hundred years) and more compact, high performance representation. It is expected to be used in conjunction with <see cref="T:NodaTime.HighPerformance.Instant64" /> , typically in scenarios where performance and/or memory usage are important. Note that in most cases, <see cref="T:NodaTime.Duration" /> is more appropriate and convenient (with more supported methods etc). This should effectively be regarded as a specialist type for unusually performance-sensitive scenarios.
struct Instant64
Represents an instant on the global timeline, with nanosecond resolution. This type is a equivalent to <see cref="T:NodaTime.Instant" /> , but with a more limited range (a few hundred years either side of the Unix epoch) and more compact, high performance representation. It is expected to be used in conjunction with <see cref="T:NodaTime.HighPerformance.Duration64" /> , typically in scenarios where performance and/or memory usage are important. Note that in most cases, <see cref="T:NodaTime.Instant" /> is more appropriate and convenient (with more supported methods etc). This should effectively be regarded as a specialist type for unusually performance-sensitive scenarios.

NodaTime.​Text

Represents a pattern for parsing and formatting <see cref="T:NodaTime.AnnualDate" /> values.
A builder for composite patterns.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.Duration" /> values.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.Instant" /> values.
Exception thrown to indicate that the format pattern provided for either formatting or parsing is invalid.
interface IPattern<​T>
Generic interface supporting parsing and formatting. Parsing always results in a <see cref="T:NodaTime.Text.ParseResult`1" /> which can represent success or failure.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.LocalDate" /> values.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.LocalDateTime" /> values.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.LocalTime" /> values.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.OffsetDate" /> values.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.OffsetDateTime" /> values.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.Offset" /> values.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.OffsetTime" /> values.
class ParseResult<​T>
The result of a parse operation.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.Period" /> values.
Ambient settings applied for the default type converters. There's no simple context to express this information in a more elegant way, although users can create their own type converters to apply if they wish to.
Exception thrown to indicate that the specified value could not be parsed.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.YearMonth" /> values.
Represents a pattern for parsing and formatting <see cref="T:NodaTime.ZonedDateTime" /> values.

NodaTime.​TimeZones

Chooses between two <see cref="T:NodaTime.ZonedDateTime" /> values that resolve to the same <see cref="T:NodaTime.LocalDateTime" /> .
Representation of a time zone converted from a <see cref="T:System.TimeZoneInfo" /> from the Base Class Library.
Provides an implementation of <see cref="T:NodaTime.TimeZones.IDateTimeZoneSource" /> that loads data from the BCL <see cref="T:System.TimeZoneInfo" /> class.
Provides an implementation of <see cref="T:NodaTime.IDateTimeZoneProvider" /> that caches results from an <see cref="T:NodaTime.TimeZones.IDateTimeZoneSource" /> .
Exception thrown when time zone is requested from an <see cref="T:NodaTime.IDateTimeZoneProvider" /> , but the specified ID is invalid for that provider.
Provides the interface for objects that can retrieve time zone definitions given an ID.
Exception thrown to indicate that a time zone source has violated the contract of <see cref="T:NodaTime.TimeZones.IDateTimeZoneSource" /> . This exception is primarily intended to be thrown from <see cref="T:NodaTime.TimeZones.DateTimeZoneCache" /> , and only in the face of a buggy source; user code should not usually need to be aware of this or catch it.
class Resolvers
Commonly-used implementations of the delegates used in resolving a <see cref="T:NodaTime.LocalDateTime" /> to a <see cref="T:NodaTime.ZonedDateTime" /> , and a method to combine two "partial" resolvers into a full one.
Resolves a <see cref="T:NodaTime.LocalDateTime" /> to a <see cref="T:NodaTime.ZonedDateTime" /> in the situation where the requested local time does not exist in the target time zone.
Provides an implementation of <see cref="T:NodaTime.TimeZones.IDateTimeZoneSource" /> that loads data originating from the <a href="https://www.iana.org/time-zones">tz database</a> (also known as the IANA Time Zone database, or zoneinfo or Olson database).
A location entry generated from the "zone1970.tab" file in a TZDB release. This can be used to provide users with a choice of time zone, although it is not internationalized. This is equivalent to <see cref="T:NodaTime.TimeZones.TzdbZoneLocation" /> , except that multiple countries may be represented.
A location entry generated from the "zone.tab" file in a TZDB release. This can be used to provide users with a choice of time zone, although it is not internationalized.
Equality comparer for time zones, comparing specific aspects of the zone intervals within a time zone for a specific interval of the time line.
class ZoneInterval
Represents a range of time for which a particular Offset applies.
The result of mapping a <see cref="T:NodaTime.LocalDateTime" /> within a time zone, i.e. finding out at what "global" time the "local" time occurred.
Resolves the result of attempting to map a local date and time to a target time zone.

NodaTime.​TimeZones.​Cldr

class MapZone
Represents a single <c>&lt;mapZone&gt;</c> element in the CLDR Windows zone mapping file.
class WindowsZones
Representation of the <c>&lt;windowsZones&gt;</c> element of CLDR supplemental data.

NodaTime.​Utility

Conversion methods which don't naturally fit into any other types - for example, for enums which can't specify any other code. In most cases, conversions to and from BCL types are provided within the type itself - such as <see cref="M:NodaTime.LocalDateTime.ToDateTimeUnspecified" /> and <see cref="M:NodaTime.LocalDateTime.FromDateTime(System.DateTime)" /> .
Exception thrown when data read by Noda Time (such as serialized time zone data) is invalid. This includes data which is truncated, i.e. we expect more data than we can read.

NodaTime.​Xml

Provides XML schema types.
Ambient settings applied during XML serialization and deserialization. XML serialization in .NET does not provide any "hooks" for advanced configuration. Most of the time that's a good thing, in terms of compatibility: we want the same data to be serialized the same way across multiple programs for interoperability. There are some exceptions to this however, where decisions need to be made and there's no single "right for everyone" choice.