Struct LocalDateTime
Implements
Inherited Members
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
[Serializable]
public struct LocalDateTime : IEquatable<LocalDateTime>, IComparable<LocalDateTime>, IComparable, IFormattable, IXmlSerializable, ISerializable
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Constructors
LocalDateTime(Int32, Int32, Int32, Int32, Int32)
Declaration
public LocalDateTime(int year, int month, int day, int hour, int minute)
Parameters
Type | Name | Description |
---|---|---|
Int32 | year | The year. This is the "absolute year", so a value of 0 means 1 BC, for example. |
Int32 | month | The month of year. |
Int32 | day | The day of month. |
Int32 | hour | The hour. |
Int32 | minute | The minute. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid date/time. |
LocalDateTime(Int32, Int32, Int32, Int32, Int32, CalendarSystem)
Declaration
public LocalDateTime(int year, int month, int day, int hour, int minute, CalendarSystem calendar)
Parameters
Type | Name | Description |
---|---|---|
Int32 | year | The year. This is the "absolute year", so, for the ISO calendar, a value of 0 means 1 BC, for example. |
Int32 | month | The month of year. |
Int32 | day | The day of month. |
Int32 | hour | The hour. |
Int32 | minute | The minute. |
CalendarSystem | calendar | The calendar. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid date/time. |
ArgumentNullException | calendar is null. |
LocalDateTime(Int32, Int32, Int32, Int32, Int32, Int32)
Declaration
public LocalDateTime(int year, int month, int day, int hour, int minute, int second)
Parameters
Type | Name | Description |
---|---|---|
Int32 | year | The year. This is the "absolute year", so a value of 0 means 1 BC, for example. |
Int32 | month | The month of year. |
Int32 | day | The day of month. |
Int32 | hour | The hour. |
Int32 | minute | The minute. |
Int32 | second | The second. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid date/time. |
LocalDateTime(Int32, Int32, Int32, Int32, Int32, Int32, CalendarSystem)
Declaration
public LocalDateTime(int year, int month, int day, int hour, int minute, int second, CalendarSystem calendar)
Parameters
Type | Name | Description |
---|---|---|
Int32 | year | The year. This is the "absolute year", so, for the ISO calendar, a value of 0 means 1 BC, for example. |
Int32 | month | The month of year. |
Int32 | day | The day of month. |
Int32 | hour | The hour. |
Int32 | minute | The minute. |
Int32 | second | The second. |
CalendarSystem | calendar | The calendar. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid date/time. |
ArgumentNullException | calendar is null. |
LocalDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32)
Declaration
public LocalDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond)
Parameters
Type | Name | Description |
---|---|---|
Int32 | year | The year. This is the "absolute year", so a value of 0 means 1 BC, for example. |
Int32 | month | The month of year. |
Int32 | day | The day of month. |
Int32 | hour | The hour. |
Int32 | minute | The minute. |
Int32 | second | The second. |
Int32 | millisecond | The millisecond. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid date/time. |
LocalDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, CalendarSystem)
Declaration
public LocalDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, CalendarSystem calendar)
Parameters
Type | Name | Description |
---|---|---|
Int32 | year | The year. This is the "absolute year", so, for the ISO calendar, a value of 0 means 1 BC, for example. |
Int32 | month | The month of year. |
Int32 | day | The day of month. |
Int32 | hour | The hour. |
Int32 | minute | The minute. |
Int32 | second | The second. |
Int32 | millisecond | The millisecond. |
CalendarSystem | calendar | The calendar. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid date/time. |
ArgumentNullException | calendar is null. |
LocalDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)
Declaration
[Obsolete("Construct with a LocalDate + LocalTime or construct to the millisecond and use PlusTicks for compatibiltiy with 2.0")]
public LocalDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int tickWithinMillisecond)
Parameters
Type | Name | Description |
---|---|---|
Int32 | year | The year. This is the "absolute year", so a value of 0 means 1 BC, for example. |
Int32 | month | The month of year. |
Int32 | day | The day of month. |
Int32 | hour | The hour. |
Int32 | minute | The minute. |
Int32 | second | The second. |
Int32 | millisecond | The millisecond. |
Int32 | tickWithinMillisecond | The tick within millisecond. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid date/time. |
LocalDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, CalendarSystem)
Declaration
[Obsolete("Construct with a LocalDate + LocalTime or construct to the millisecond and use PlusTicks for compatibiltiy with 2.0")]
public LocalDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int tickWithinMillisecond, CalendarSystem calendar)
Parameters
Type | Name | Description |
---|---|---|
Int32 | year | The year. This is the "absolute year", so, for the ISO calendar, a value of 0 means 1 BC, for example. |
Int32 | month | The month of year. |
Int32 | day | The day of month. |
Int32 | hour | The hour. |
Int32 | minute | The minute. |
Int32 | second | The second. |
Int32 | millisecond | The millisecond. |
Int32 | tickWithinMillisecond | The tick within millisecond. |
CalendarSystem | calendar | The calendar. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid date/time. |
ArgumentNullException | calendar is null. |
Properties
Calendar
Declaration
public CalendarSystem Calendar { get; }
Property Value
Type | Description |
---|---|
CalendarSystem |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
CenturyOfEra
Declaration
[Obsolete("Century-based properties have been removed in 2.0")]
public int CenturyOfEra { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
ClockHourOfHalfDay
Declaration
public int ClockHourOfHalfDay { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Date
Declaration
public LocalDate Date { get; }
Property Value
Type | Description |
---|---|
LocalDate |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Day
Declaration
public int Day { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
DayOfWeek
Declaration
public int DayOfWeek { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
See Also
DayOfYear
Declaration
public int DayOfYear { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Era
Declaration
public Era Era { get; }
Property Value
Type | Description |
---|---|
Era |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Hour
Declaration
public int Hour { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
IsoDayOfWeek
Declaration
public IsoDayOfWeek IsoDayOfWeek { get; }
Property Value
Type | Description |
---|---|
IsoDayOfWeek |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The underlying calendar doesn't use ISO days of the week. |
See Also
Millisecond
Declaration
public int Millisecond { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Minute
Declaration
public int Minute { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Month
Declaration
public int Month { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Second
Declaration
public int Second { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
TickOfDay
Declaration
public long TickOfDay { get; }
Property Value
Type | Description |
---|---|
Int64 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
TickOfSecond
Declaration
public int TickOfSecond { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
TimeOfDay
Declaration
public LocalTime TimeOfDay { get; }
Property Value
Type | Description |
---|---|
LocalTime |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
WeekOfWeekYear
Declaration
[Obsolete("Use WeekYearRules for specific week-year rules for compatibility with 2.0.")]
public int WeekOfWeekYear { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
WeekYear
Declaration
[Obsolete("Use WeekYearRules for specific week-year rules for compatibility with 2.0.")]
public int WeekYear { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
The WeekYear is the year that matches with the WeekOfWeekYear field. In the standard ISO8601 week algorithm, the first week of the year is that in which at least 4 days are in the year. As a result of this definition, day 1 of the first week may be in the previous year. The WeekYear allows you to query the effective year for that day.
For example, January 1st 2011 was a Saturday, so only two days of that week (Saturday and Sunday) were in 2011. Therefore January 1st is part of week 52 of WeekYear 2010. Conversely, December 31st 2012 is a Monday, so is part of week 1 of WeekYear 2013.
Year
Declaration
public int Year { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
YearOfCentury
Declaration
[Obsolete("Century-based properties have been removed in 2.0")]
public int YearOfCentury { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
YearOfEra
Declaration
public int YearOfEra { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Methods
Add(LocalDateTime, Period)
operator+()
.
Declaration
public static LocalDateTime Add(LocalDateTime localDateTime, Period period)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | localDateTime | Initial local date and time |
Period | period | Period to add |
Returns
Type | Description |
---|---|
LocalDateTime | The resulting local date and time |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
CompareTo(LocalDateTime)
Declaration
public int CompareTo(LocalDateTime other)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | other | The other local date/time to compare with this value. |
Returns
Type | Description |
---|---|
Int32 | A value less than zero if this date/time is earlier than other ;
zero if this date/time is the same as other ; a value greater than zero if this date/time is
later than other . |
Remarks
Equals(LocalDateTime)
Declaration
public bool Equals(LocalDateTime other)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
Boolean |
true if the current object is equal to the other parameter; otherwise, false.
|
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The Object to compare with this instance. |
Returns
Type | Description |
---|---|
Boolean |
true if the specified Object is equal to this instance;
otherwise, false .
|
Overrides
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
FromDateTime(DateTime)
Declaration
public static LocalDateTime FromDateTime(DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | Value to convert into a Noda Time local date and time |
Returns
Type | Description |
---|---|
LocalDateTime | A new LocalDateTime with the same values as the specified DateTime . |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
InUtc()
Declaration
public ZonedDateTime InUtc()
Returns
Type | Description |
---|---|
ZonedDateTime | The result of mapping this local date/time in UTC. |
Remarks
InZone(DateTimeZone, ZoneLocalMappingResolver)
Declaration
public ZonedDateTime InZone(DateTimeZone zone, ZoneLocalMappingResolver resolver)
Parameters
Type | Name | Description |
---|---|---|
DateTimeZone | zone | The time zone to map this local date and time into |
ZoneLocalMappingResolver | resolver | The resolver to apply to the mapping. |
Returns
Type | Description |
---|---|
ZonedDateTime | The result of resolving the mapping. |
Remarks
Exceptions
Type | Condition |
---|---|
ArgumentNullException | zone or resolver is null |
InZoneLeniently(DateTimeZone)
Declaration
public ZonedDateTime InZoneLeniently(DateTimeZone zone)
Parameters
Type | Name | Description |
---|---|---|
DateTimeZone | zone | The time zone in which to map this local date/time. |
Returns
Type | Description |
---|---|
ZonedDateTime | The result of mapping this local date/time in the given time zone. |
Remarks
Exceptions
Type | Condition |
---|---|
ArgumentNullException | zone is null. |
InZoneStrictly(DateTimeZone)
Declaration
public ZonedDateTime InZoneStrictly(DateTimeZone zone)
Parameters
Type | Name | Description |
---|---|---|
DateTimeZone | zone | The time zone in which to map this local date/time. |
Returns
Type | Description |
---|---|
ZonedDateTime | The result of mapping this local date/time in the given time zone. |
Remarks
Exceptions
Type | Condition |
---|---|
SkippedTimeException | This local date/time is skipped in the given time zone. |
AmbiguousTimeException | This local date/time is ambiguous in the given time zone. |
ArgumentNullException | zone is null. |
Minus(Period)
Declaration
public LocalDateTime Minus(Period period)
Parameters
Type | Name | Description |
---|---|---|
Period | period | Period to subtract |
Returns
Type | Description |
---|---|
LocalDateTime | The resulting local date and time |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Next(IsoDayOfWeek)
Declaration
public LocalDateTime Next(IsoDayOfWeek targetDayOfWeek)
Parameters
Type | Name | Description |
---|---|---|
IsoDayOfWeek | targetDayOfWeek | The ISO day of the week to return the next date of. |
Returns
Type | Description |
---|---|
LocalDateTime | The next LocalDateTime falling on the specified day of the week. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The underlying calendar doesn't use ISO days of the week. |
ArgumentOutOfRangeException | targetDayOfWeek is not a valid day of the
week (Monday to Sunday). |
Plus(Period)
Declaration
public LocalDateTime Plus(Period period)
Parameters
Type | Name | Description |
---|---|---|
Period | period | Period to add |
Returns
Type | Description |
---|---|
LocalDateTime | The resulting local date and time |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
PlusDays(Int32)
Declaration
public LocalDateTime PlusDays(int days)
Parameters
Type | Name | Description |
---|---|---|
Int32 | days | The number of days to add |
Returns
Type | Description |
---|---|
LocalDateTime | The current value plus the given number of days. |
Remarks
This method does not try to maintain the month or year of the current value, so adding 3 days to a value on January 30th will result in a value on February 2nd.
PlusHours(Int64)
Declaration
public LocalDateTime PlusHours(long hours)
Parameters
Type | Name | Description |
---|---|---|
Int64 | hours | The number of hours to add |
Returns
Type | Description |
---|---|
LocalDateTime | The current value plus the given number of hours. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
PlusMilliseconds(Int64)
Declaration
public LocalDateTime PlusMilliseconds(long milliseconds)
Parameters
Type | Name | Description |
---|---|---|
Int64 | milliseconds | The number of milliseconds to add |
Returns
Type | Description |
---|---|
LocalDateTime | The current value plus the given number of milliseconds. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
PlusMinutes(Int64)
Declaration
public LocalDateTime PlusMinutes(long minutes)
Parameters
Type | Name | Description |
---|---|---|
Int64 | minutes | The number of minutes to add |
Returns
Type | Description |
---|---|
LocalDateTime | The current value plus the given number of minutes. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
PlusMonths(Int32)
Declaration
public LocalDateTime PlusMonths(int months)
Parameters
Type | Name | Description |
---|---|---|
Int32 | months | The number of months to add |
Returns
Type | Description |
---|---|
LocalDateTime | The current value plus the given number of months. |
Remarks
This method does not try to maintain the year of the current value, so adding four months to a value in October will result in a value in the following February.
If the resulting date is invalid, the day of month is reduced to find a valid value. For example, adding one month to January 30th 2011 will return February 28th 2011; subtracting one month from March 30th 2011 will return February 28th 2011.
PlusSeconds(Int64)
Declaration
public LocalDateTime PlusSeconds(long seconds)
Parameters
Type | Name | Description |
---|---|---|
Int64 | seconds | The number of seconds to add |
Returns
Type | Description |
---|---|
LocalDateTime | The current value plus the given number of seconds. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
PlusTicks(Int64)
Declaration
public LocalDateTime PlusTicks(long ticks)
Parameters
Type | Name | Description |
---|---|---|
Int64 | ticks | The number of ticks to add |
Returns
Type | Description |
---|---|
LocalDateTime | The current value plus the given number of ticks. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
PlusWeeks(Int32)
Declaration
public LocalDateTime PlusWeeks(int weeks)
Parameters
Type | Name | Description |
---|---|---|
Int32 | weeks | The number of weeks to add |
Returns
Type | Description |
---|---|
LocalDateTime | The current value plus the given number of weeks. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
PlusYears(Int32)
Declaration
public LocalDateTime PlusYears(int years)
Parameters
Type | Name | Description |
---|---|---|
Int32 | years | The number of years to add |
Returns
Type | Description |
---|---|
LocalDateTime | The current value plus the given number of years. |
Remarks
Previous(IsoDayOfWeek)
Declaration
public LocalDateTime Previous(IsoDayOfWeek targetDayOfWeek)
Parameters
Type | Name | Description |
---|---|---|
IsoDayOfWeek | targetDayOfWeek | The ISO day of the week to return the previous date of. |
Returns
Type | Description |
---|---|
LocalDateTime | The previous LocalDateTime falling on the specified day of the week. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The underlying calendar doesn't use ISO days of the week. |
ArgumentOutOfRangeException | targetDayOfWeek is not a valid day of the
week (Monday to Sunday). |
Subtract(LocalDateTime, Period)
operator-()
.
Declaration
public static LocalDateTime Subtract(LocalDateTime localDateTime, Period period)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | localDateTime | Initial local date and time |
Period | period | Period to subtract |
Returns
Type | Description |
---|---|
LocalDateTime | The resulting local date and time |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
ToDateTimeUnspecified()
Declaration
public DateTime ToDateTimeUnspecified()
Returns
Type | Description |
---|---|
DateTime | A DateTime value for the same date and time as this value. |
Remarks
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The value of the current instance in the default format pattern ("G"), using the current thread's culture to obtain a format provider. |
Overrides
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
ToString(String, IFormatProvider)
Declaration
public string ToString(string patternText, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
String | patternText | The String specifying the pattern to use, or null to use the default format pattern ("G"). |
IFormatProvider | formatProvider | The IFormatProvider to use when formatting the value, or null to use the current thread's culture to obtain a format provider. |
Returns
Type | Description |
---|---|
String | A String containing the value of the current instance in the specified format. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
WithCalendar(CalendarSystem)
Declaration
public LocalDateTime WithCalendar(CalendarSystem calendarSystem)
Parameters
Type | Name | Description |
---|---|---|
CalendarSystem | calendarSystem | The calendar system to convert this local date to. |
Returns
Type | Description |
---|---|
LocalDateTime | The converted LocalDateTime. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | calendarSystem is null. |
WithOffset(Offset)
Declaration
public OffsetDateTime WithOffset(Offset offset)
Parameters
Type | Name | Description |
---|---|---|
Offset | offset | The offset to apply. |
Returns
Type | Description |
---|---|
OffsetDateTime | The result of this local date/time offset by the given amount. |
Remarks
Operators
Addition(LocalDateTime, Period)
Declaration
public static LocalDateTime operator +(LocalDateTime localDateTime, Period period)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | localDateTime | Initial local date and time |
Period | period | Period to add |
Returns
Type | Description |
---|---|
LocalDateTime | The resulting local date and time |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Equality(LocalDateTime, LocalDateTime)
Declaration
public static bool operator ==(LocalDateTime left, LocalDateTime right)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | left | The left hand side of the operator. |
LocalDateTime | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if values are equal to each other, otherwise false . |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
GreaterThan(LocalDateTime, LocalDateTime)
Declaration
public static bool operator>(LocalDateTime lhs, LocalDateTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | lhs | First operand of the comparison |
LocalDateTime | rhs | Second operand of the comparison |
Returns
Type | Description |
---|---|
Boolean | true if the lhs is strictly later than rhs , false otherwise. |
Remarks
GreaterThanOrEqual(LocalDateTime, LocalDateTime)
Declaration
public static bool operator >=(LocalDateTime lhs, LocalDateTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | lhs | First operand of the comparison |
LocalDateTime | rhs | Second operand of the comparison |
Returns
Type | Description |
---|---|
Boolean | true if the lhs is later than or equal to rhs , false otherwise. |
Remarks
Inequality(LocalDateTime, LocalDateTime)
Declaration
public static bool operator !=(LocalDateTime left, LocalDateTime right)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | left | The left hand side of the operator. |
LocalDateTime | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if values are not equal to each other, otherwise false . |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
LessThan(LocalDateTime, LocalDateTime)
Declaration
public static bool operator <(LocalDateTime lhs, LocalDateTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | lhs | First operand of the comparison |
LocalDateTime | rhs | Second operand of the comparison |
Returns
Type | Description |
---|---|
Boolean | true if the lhs is strictly earlier than rhs , false otherwise. |
Remarks
LessThanOrEqual(LocalDateTime, LocalDateTime)
Declaration
public static bool operator <=(LocalDateTime lhs, LocalDateTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | lhs | First operand of the comparison |
LocalDateTime | rhs | Second operand of the comparison |
Returns
Type | Description |
---|---|
Boolean | true if the lhs is earlier than or equal to rhs , false otherwise. |
Remarks
Subtraction(LocalDateTime, Period)
Declaration
public static LocalDateTime operator -(LocalDateTime localDateTime, Period period)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | localDateTime | Initial local date and time |
Period | period | Period to subtract |
Returns
Type | Description |
---|---|
LocalDateTime | The resulting local date and time |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
Explicit Interface Implementations
IComparable.CompareTo(Object)
Declaration
int IComparable.CompareTo(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare this value with. |
Returns
Type | Description |
---|---|
Int32 | The result of comparing this LocalDateTime with another one; see CompareTo(LocalDateTime) for general details.
If obj is null, this method returns a value greater than 0.
|
Remarks
Exceptions
Type | Condition |
---|---|
ArgumentException | obj is non-null but does not refer to an instance of LocalDateTime. |
ISerializable.GetObjectData(SerializationInfo, StreamingContext)
Declaration
[SecurityCritical]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | The SerializationInfo to populate with data. |
StreamingContext | context | The destination for this serialization. |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
IXmlSerializable.GetSchema()
Declaration
XmlSchema IXmlSerializable.GetSchema()
Returns
Type | Description |
---|---|
XmlSchema |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
IXmlSerializable.ReadXml(XmlReader)
Declaration
void IXmlSerializable.ReadXml(XmlReader reader)
Parameters
Type | Name | Description |
---|---|---|
XmlReader | reader |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.
IXmlSerializable.WriteXml(XmlWriter)
Declaration
void IXmlSerializable.WriteXml(XmlWriter writer)
Parameters
Type | Name | Description |
---|---|---|
XmlWriter | writer |
Remarks
This type defaults to using the IsoCalendarSystem unless a different calendar system is specified.
Comparisons of values can be handled in a way which is either calendar-sensitive or calendar-insensitive. Noda Time implements all the operators (and the Equals(LocalDateTime) method) such that all operators other than Inequality(LocalDateTime, LocalDateTime) will return false if asked to compare two values in different calendar systems.
However, the CompareTo(LocalDateTime) method (implementing IComparable<T>) is calendar-insensitive; it compares the two values historically in terms of when they actually occurred, as if they're both converted to some "neutral" calendar system first.
It's unclear at the time of this writing whether this is the most appropriate approach, and it may change in future versions. In general, it would be a good idea for users to avoid comparing dates in different calendar systems, and indeed most users are unlikely to ever explicitly consider which calendar system they're working in anyway.