NodaTime NamespaceNoda Time

[This is preliminary documentation and is subject to change.]

The NodaTime namespace contains the core types for Noda Time, including the main public classes for time zone and calendar support which have implementations (and less frequently used types) in other namespaces. For formatting and parsing functionality, see the NodaTime.Text namespace.

Classes

  ClassDescription
Public classAmbiguousTimeException
Exception thrown to indicate that the specified local date/time occurs twice in a particular time zone due to daylight saving time changes.
Public classCalendarSystem
A calendar system maps the non-calendar-specific "local time line" to human concepts such as years, months and days.
Public classDateAdjusters
Factory class for date adjusters: functions from LocalDate to LocalDate, which can be applied to LocalDate, LocalDateTime, and OffsetDateTime.
Public classDateInterval
An interval between two dates.
Public classDateTimeZone
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.
Public classDateTimeZoneProviders
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.
Public classNodaConstants
Useful constants, mostly along the lines of "number of milliseconds in an hour".
Public classOffsetDateTime Comparer
Base class for OffsetDateTime comparers.
Public classPeriod
Represents a period of time expressed in human chronological terms: hours, days, weeks, months and so on.
Public classPeriodBuilder
A mutable builder class for Period values. Each property can be set independently, and then a Period can be created from the result using the Build  method.
Public classSkippedTimeException
Exception thrown to indicate that the specified local time doesn't exist in a particular time zone due to daylight saving time changes.
Public classSystemClock
Singleton implementation of 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.
Public classTimeAdjusters
Factory class for time adjusters: functions from LocalTime to LocalTime, which can be applied to LocalTime, LocalDateTime, and OffsetDateTime.
Public classZonedClock
A clock with an associated time zone and calendar. This is effectively a convenience class decorating an IClock.
Public classZonedDateTime Comparer
Base class for ZonedDateTime comparers.
Structures

  StructureDescription
Public structureAnnualDate
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.
Public structureDuration
Represents a fixed (and calendar-independent) length of time.
Public structureInstant
Represents an instant on the global timeline.
Public structureInterval
An interval between two instants in time (start and end).
Public structureLocalDate
LocalDate is an immutable struct representing a date within the calendar, with no reference to a particular time zone or time of day.
Public structureLocalDateTime
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.
Public structureLocalTime
LocalTime is an immutable struct representing a time of day, with no reference to a particular calendar, time zone or date.
Public structureOffset
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).
Public structureOffsetDateTime
A local date and time in a particular calendar system, combined with an offset from UTC. This is broadly similar to OnlineDateTimeOffset in the BCL.
Public structureZonedDateTime
A LocalDateTime in a specific time zone and with a particular offset to distinguish between otherwise-ambiguous instants. A ZonedDateTime is global, in that it maps to a single Instant.
Interfaces

  InterfaceDescription
Public interfaceIClock
Represents a clock which can return the current time as an Instant.
Public interfaceIDateTimeZoneProvider
Provides stable, performant time zone data.
Enumerations

  EnumerationDescription
Public enumerationIsoDayOfWeek
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.
Public enumerationPeriodUnits
The units within a 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.