Struct LocalTime
LocalTime is an immutable struct representing a time of day, with no reference
to a particular calendar, time zone or date.
Since 1.0.x
Availability net45, netstandard1.3
Implements
IEquatable<LocalTime>
IComparable<LocalTime>
IFormattable
IComparable
IXmlSerializable
ISerializable
Inherited Members
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetType()
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
[Serializable]
public struct LocalTime : IEquatable<LocalTime>, IComparable<LocalTime>, IFormattable, IComparable, IXmlSerializable, ISerializable
Constructors
LocalTime(Int32, Int32)
Creates a local time at the given hour and minute, with second, millisecond-of-second
and tick-of-millisecond values of zero.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime(int hour, int minute)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hour | The hour of day. |
Int32 | minute | The minute of the hour. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid time. |
LocalTime(Int32, Int32, Int32)
Creates a local time at the given hour, minute and second,
with millisecond-of-second and tick-of-millisecond values of zero.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime(int hour, int minute, int second)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hour | The hour of day. |
Int32 | minute | The minute of the hour. |
Int32 | second | The second of the minute. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid time. |
LocalTime(Int32, Int32, Int32, Int32)
Creates a local time at the given hour, minute, second and millisecond,
with a tick-of-millisecond value of zero.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime(int hour, int minute, int second, int millisecond)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hour | The hour of day. |
Int32 | minute | The minute of the hour. |
Int32 | second | The second of the minute. |
Int32 | millisecond | The millisecond of the second. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid time. |
Properties
ClockHourOfHalfDay
Gets the hour of the half-day of this local time, in the range 1 to 12 inclusive.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public int ClockHourOfHalfDay { get; }
Property Value
Type | Description |
---|---|
Int32 | The hour of the half-day of this local time, in the range 1 to 12 inclusive. |
Hour
Gets the hour of day of this local time, in the range 0 to 23 inclusive.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public int Hour { get; }
Property Value
Type | Description |
---|---|
Int32 | The hour of day of this local time, in the range 0 to 23 inclusive. |
MaxValue
The maximum value of this type, one nanosecond before midnight.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime MaxValue { get; }
Property Value
Type | Description |
---|---|
LocalTime |
Remarks
This is useful if you have to use an inclusive upper bound for some reason.
In general, it's better to use an exclusive upper bound, in which case use midnight of
the following day.
Midnight
Local time at midnight, i.e. 0 hours, 0 minutes, 0 seconds.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime Midnight { get; }
Property Value
Type | Description |
---|---|
LocalTime |
Millisecond
Gets the millisecond of this local time within the second, in the range 0 to 999 inclusive.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public int Millisecond { get; }
Property Value
Type | Description |
---|---|
Int32 | The millisecond of this local time within the second, in the range 0 to 999 inclusive. |
Minute
Gets the minute of this local time, in the range 0 to 59 inclusive.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public int Minute { get; }
Property Value
Type | Description |
---|---|
Int32 | The minute of this local time, in the range 0 to 59 inclusive. |
MinValue
The minimum value of this type; equivalent to Midnight.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime MinValue { get; }
Property Value
Type | Description |
---|---|
LocalTime |
NanosecondOfDay
Gets the nanosecond of this local time within the day, in the range 0 to 86,399,999,999,999 inclusive.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public long NanosecondOfDay { get; }
Property Value
Type | Description |
---|---|
Int64 | The nanosecond of this local time within the day, in the range 0 to 86,399,999,999,999 inclusive. |
NanosecondOfSecond
Gets the nanosecond of this local time within the second, in the range 0 to 999,999,999 inclusive.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public int NanosecondOfSecond { get; }
Property Value
Type | Description |
---|---|
Int32 | The nanosecond of this local time within the second, in the range 0 to 999,999,999 inclusive. |
Noon
Local time at noon, i.e. 12 hours, 0 minutes, 0 seconds.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime Noon { get; }
Property Value
Type | Description |
---|---|
LocalTime |
Second
Gets the second of this local time within the minute, in the range 0 to 59 inclusive.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public int Second { get; }
Property Value
Type | Description |
---|---|
Int32 | The second of this local time within the minute, in the range 0 to 59 inclusive. |
TickOfDay
Gets the tick of this local time within the day, in the range 0 to 863,999,999,999 inclusive.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public long TickOfDay { get; }
Property Value
Type | Description |
---|---|
Int64 | The tick of this local time within the day, in the range 0 to 863,999,999,999 inclusive. |
Remarks
If the value does not fall on a tick boundary, it will be truncated towards zero.
TickOfSecond
Gets the tick of this local time within the second, in the range 0 to 9,999,999 inclusive.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public int TickOfSecond { get; }
Property Value
Type | Description |
---|---|
Int32 | The tick of this local time within the second, in the range 0 to 9,999,999 inclusive. |
Methods
Add(LocalTime, Period)
Adds the specified period to the time. Friendly alternative to
operator+()
.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime Add(LocalTime time, Period period)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | time | The time to add the period to |
Period | period | The period to add. Must not contain any (non-zero) date units. |
Returns
Type | Description |
---|---|
LocalTime | The sum of the given time and period |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | period is null. |
CompareTo(LocalTime)
Indicates whether this time is earlier, later or the same as another one.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public int CompareTo(LocalTime other)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | other | The other date/time to compare this one with |
Returns
Type | Description |
---|---|
Int32 | A value less than zero if this time is earlier than other ;
zero if this time is the same as other ; a value greater than zero if this time is
later than other . |
Equals(LocalTime)
Compares this local time with the specified one for equality,
by checking whether the two values represent the exact same local time, down to the tick.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public bool Equals(LocalTime other)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | other | The other local time to compare this one with |
Returns
Type | Description |
---|---|
Boolean | True if the specified time is equal to this one; false otherwise |
Equals(Object)
Compares this local time with the specified reference. A local time is
only equal to another local time with the same underlying tick value.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare this one with |
Returns
Type | Description |
---|---|
Boolean | True if the specified value is a local time which is equal to this one; false otherwise |
Overrides
System.ValueType.Equals(System.Object)
FromHourMinuteSecondMillisecondTick(Int32, Int32, Int32, Int32, Int32)
Factory method to create a local time at the given hour, minute, second, millisecond and tick within millisecond.
Since 1.4.x
Availability net45, netstandard1.3
Declaration
public static LocalTime FromHourMinuteSecondMillisecondTick(int hour, int minute, int second, int millisecond, int tickWithinMillisecond)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hour | The hour of day. |
Int32 | minute | The minute of the hour. |
Int32 | second | The second of the minute. |
Int32 | millisecond | The millisecond of the second. |
Int32 | tickWithinMillisecond | The tick within the millisecond. |
Returns
Type | Description |
---|---|
LocalTime | The resulting time. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid time. |
FromHourMinuteSecondNanosecond(Int32, Int32, Int32, Int64)
Factory method for creating a local time from the hour of day, minute of hour, second of minute, and nanosecond of second.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime FromHourMinuteSecondNanosecond(int hour, int minute, int second, long nanosecondWithinSecond)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hour | The hour of day in the desired time, in the range [0, 23]. |
Int32 | minute | The minute of hour in the desired time, in the range [0, 59]. |
Int32 | second | The second of minute in the desired time, in the range [0, 59]. |
Int64 | nanosecondWithinSecond | The nanosecond within the second in the desired time, in the range [0, 999999999]. |
Returns
Type | Description |
---|---|
LocalTime | The resulting time. |
Remarks
This is not a constructor overload as it would have the same signature as the one taking millisecond of second.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid time. |
FromHourMinuteSecondTick(Int32, Int32, Int32, Int32)
Factory method for creating a local time from the hour of day, minute of hour, second of minute, and tick of second.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime FromHourMinuteSecondTick(int hour, int minute, int second, int tickWithinSecond)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hour | The hour of day in the desired time, in the range [0, 23]. |
Int32 | minute | The minute of hour in the desired time, in the range [0, 59]. |
Int32 | second | The second of minute in the desired time, in the range [0, 59]. |
Int32 | tickWithinSecond | The tick within the second in the desired time, in the range [0, 9999999]. |
Returns
Type | Description |
---|---|
LocalTime | The resulting time. |
Remarks
This is not a constructor overload as it would have the same signature as the one taking millisecond of second.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The parameters do not form a valid time. |
FromMillisecondsSinceMidnight(Int32)
Factory method for creating a local time from the number of milliseconds which have elapsed since midnight.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public static LocalTime FromMillisecondsSinceMidnight(int milliseconds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | milliseconds | The number of milliseconds, in the range [0, 86,399,999] |
Returns
Type | Description |
---|---|
LocalTime | The resulting time. |
FromSecondsSinceMidnight(Int32)
Factory method for creating a local time from the number of seconds which have elapsed since midnight.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public static LocalTime FromSecondsSinceMidnight(int seconds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | seconds | The number of seconds, in the range [0, 86,399] |
Returns
Type | Description |
---|---|
LocalTime | The resulting time. |
FromTicksSinceMidnight(Int64)
Factory method for creating a local time from the number of ticks which have elapsed since midnight.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public static LocalTime FromTicksSinceMidnight(long ticks)
Parameters
Type | Name | Description |
---|---|---|
Int64 | ticks | The number of ticks, in the range [0, 863,999,999,999] |
Returns
Type | Description |
---|---|
LocalTime | The resulting time. |
GetHashCode()
Returns a hash code for this local time.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this local time. |
Overrides
System.ValueType.GetHashCode()
Minus(LocalTime)
Subtracts the specified time from this time, returning the result as a Period.
Fluent alternative to
operator-()
.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public Period Minus(LocalTime time)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | time | The time to subtract from this |
Returns
Type | Description |
---|---|
Period | The difference between the specified time and this one |
Minus(Period)
Subtracts the specified period from this time. Fluent alternative to
operator-()
.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime Minus(Period period)
Parameters
Type | Name | Description |
---|---|---|
Period | period | The period to subtract. Must not contain any (non-zero) date units. |
Returns
Type | Description |
---|---|
LocalTime | The result of subtracting the given period from this time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | period is null. |
On(LocalDate)
Combines this LocalTime with the given LocalDate
into a single LocalDateTime.
Fluent alternative to
operator+()
.
Since 1.3.x
Availability net45, netstandard1.3
Declaration
public LocalDateTime On(LocalDate date)
Parameters
Type | Name | Description |
---|---|---|
LocalDate | date | The date to combine with this time |
Returns
Type | Description |
---|---|
LocalDateTime | The LocalDateTime representation of the given time on this date |
Plus(Period)
Adds the specified period to this time. Fluent alternative to
operator+()
.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime Plus(Period period)
Parameters
Type | Name | Description |
---|---|---|
Period | period | The period to add. Must not contain any (non-zero) date units. |
Returns
Type | Description |
---|---|
LocalTime | The sum of this time and the given period |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | period is null. |
PlusHours(Int64)
Returns a new LocalTime representing the current value with the given number of hours added.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime PlusHours(long hours)
Parameters
Type | Name | Description |
---|---|---|
Int64 | hours | The number of hours to add |
Returns
Type | Description |
---|---|
LocalTime | The current value plus the given number of hours. |
Remarks
If the value goes past the start or end of the day, it wraps - so 11pm plus two hours is 1am, for example.
PlusMilliseconds(Int64)
Returns a new LocalTime representing the current value with the given number of milliseconds added.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime PlusMilliseconds(long milliseconds)
Parameters
Type | Name | Description |
---|---|---|
Int64 | milliseconds | The number of milliseconds to add |
Returns
Type | Description |
---|---|
LocalTime | The current value plus the given number of milliseconds. |
PlusMinutes(Int64)
Returns a new LocalTime representing the current value with the given number of minutes added.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime PlusMinutes(long minutes)
Parameters
Type | Name | Description |
---|---|---|
Int64 | minutes | The number of minutes to add |
Returns
Type | Description |
---|---|
LocalTime | The current value plus the given number of minutes. |
Remarks
If the value goes past the start or end of the day, it wraps - so 11pm plus 120 minutes is 1am, for example.
PlusNanoseconds(Int64)
Returns a new LocalTime representing the current value with the given number of nanoseconds added.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime PlusNanoseconds(long nanoseconds)
Parameters
Type | Name | Description |
---|---|---|
Int64 | nanoseconds | The number of nanoseconds to add |
Returns
Type | Description |
---|---|
LocalTime | The current value plus the given number of ticks. |
PlusSeconds(Int64)
Returns a new LocalTime representing the current value with the given number of seconds added.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime PlusSeconds(long seconds)
Parameters
Type | Name | Description |
---|---|---|
Int64 | seconds | The number of seconds to add |
Returns
Type | Description |
---|---|
LocalTime | The current value plus the given number of seconds. |
Remarks
If the value goes past the start or end of the day, it wraps - so 11:59pm plus 120 seconds is 12:01am, for example.
PlusTicks(Int64)
Returns a new LocalTime representing the current value with the given number of ticks added.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime PlusTicks(long ticks)
Parameters
Type | Name | Description |
---|---|---|
Int64 | ticks | The number of ticks to add |
Returns
Type | Description |
---|---|
LocalTime | The current value plus the given number of ticks. |
Subtract(LocalTime, LocalTime)
Subtracts one time from another, returning the result as a Period with units of years, months and days.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static Period Subtract(LocalTime lhs, LocalTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | lhs | The time to subtract from |
LocalTime | rhs | The time to subtract |
Returns
Type | Description |
---|---|
Period | The result of subtracting one time from another. |
Remarks
This is simply a convenience method for calling Between(LocalTime, LocalTime).
Subtract(LocalTime, Period)
Subtracts the specified period from the time. Friendly alternative to
operator-()
.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime Subtract(LocalTime time, Period period)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | time | The time to subtract the period from |
Period | period | The period to subtract. Must not contain any (non-zero) date units. |
Returns
Type | Description |
---|---|
LocalTime | The result of subtracting the given period from the time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | period is null. |
ToString()
Returns a System.String that represents this instance.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The value of the current instance in the default format pattern ("T"), using the current thread's culture to obtain a format provider. |
Overrides
System.ValueType.ToString()
ToString(String, IFormatProvider)
Formats the value of the current instance using the specified pattern.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public string ToString(string patternText, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
String | patternText | The System.String specifying the pattern to use, or null to use the default format pattern ("T"). |
IFormatProvider | formatProvider | The System.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 System.String containing the value of the current instance in the specified format. |
With(Func<LocalTime, LocalTime>)
Returns this time, with the given adjuster applied to it.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public LocalTime With(Func<LocalTime, LocalTime> adjuster)
Parameters
Type | Name | Description |
---|---|---|
Func<LocalTime, LocalTime> | adjuster | The adjuster to apply. |
Returns
Type | Description |
---|---|
LocalTime | The adjusted time. |
Remarks
If the adjuster attempts to construct an invalid time, any exception thrown by
that construction attempt will be propagated through this method.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | adjuster is null. |
Operators
Addition(LocalTime, Period)
Creates a new local time by adding a period to an existing time. The period must not contain
any date-related units (days etc) with non-zero values.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime operator +(LocalTime time, Period period)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | time | The time to add the period to |
Period | period | The period to add |
Returns
Type | Description |
---|---|
LocalTime | The result of adding the period to the time, wrapping via midnight if necessary |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | period is null. |
Equality(LocalTime, LocalTime)
Compares two local times for equality, by checking whether they represent
the exact same local time, down to the tick.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static bool operator ==(LocalTime lhs, LocalTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | lhs | The first value to compare |
LocalTime | rhs | The second value to compare |
Returns
Type | Description |
---|---|
Boolean | True if the two times are the same; false otherwise |
GreaterThan(LocalTime, LocalTime)
Compares two LocalTime values to see if the left one is strictly later than the right
one.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static bool operator>(LocalTime lhs, LocalTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | lhs | First operand of the comparison |
LocalTime | rhs | Second operand of the comparison |
Returns
Type | Description |
---|---|
Boolean | true if the lhs is strictly later than rhs , false otherwise. |
GreaterThanOrEqual(LocalTime, LocalTime)
Compares two LocalTime values to see if the left one is later than or equal to the right
one.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static bool operator >=(LocalTime lhs, LocalTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | lhs | First operand of the comparison |
LocalTime | rhs | Second operand of the comparison |
Returns
Type | Description |
---|---|
Boolean | true if the lhs is later than or equal to rhs , false otherwise. |
Inequality(LocalTime, LocalTime)
Compares two local times for inequality.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static bool operator !=(LocalTime lhs, LocalTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | lhs | The first value to compare |
LocalTime | rhs | The second value to compare |
Returns
Type | Description |
---|---|
Boolean | False if the two times are the same; true otherwise |
LessThan(LocalTime, LocalTime)
Compares two LocalTime values to see if the left one is strictly earlier than the right
one.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static bool operator <(LocalTime lhs, LocalTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | lhs | First operand of the comparison |
LocalTime | rhs | Second operand of the comparison |
Returns
Type | Description |
---|---|
Boolean | true if the lhs is strictly earlier than rhs , false otherwise. |
LessThanOrEqual(LocalTime, LocalTime)
Compares two LocalTime values to see if the left one is earlier than or equal to the right
one.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static bool operator <=(LocalTime lhs, LocalTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | lhs | First operand of the comparison |
LocalTime | rhs | Second operand of the comparison |
Returns
Type | Description |
---|---|
Boolean | true if the lhs is earlier than or equal to rhs , false otherwise. |
Subtraction(LocalTime, LocalTime)
Subtracts one time from another, returning the result as a Period.
Since 2.0.x
Availability net45, netstandard1.3
Declaration
public static Period operator -(LocalTime lhs, LocalTime rhs)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | lhs | The time to subtract from |
LocalTime | rhs | The time to subtract |
Returns
Type | Description |
---|---|
Period | The result of subtracting one time from another. |
Remarks
This is simply a convenience operator for calling Between(LocalTime, LocalTime).
Subtraction(LocalTime, Period)
Creates a new local time by subtracting a period from an existing time. The period must not contain
any date-related units (days etc) with non-zero values.
This is a convenience operator over the Minus(Period) method.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public static LocalTime operator -(LocalTime time, Period period)
Parameters
Type | Name | Description |
---|---|---|
LocalTime | time | The time to subtract the period from |
Period | period | The period to subtract |
Returns
Type | Description |
---|---|
LocalTime | The result of subtract the period from the time, wrapping via midnight if necessary |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | period is null. |
Explicit Interface Implementations
IComparable.CompareTo(Object)
Implementation of System.IComparable.CompareTo(System.Object) to compare two LocalTimes.
Since 1.1.x
Availability net45, netstandard1.3
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 LocalTime with another one; see CompareTo(LocalTime) for general details.
If obj is null, this method returns a value greater than 0.
|
Remarks
This uses explicit interface implementation to avoid it being called accidentally. The generic implementation should usually be preferred.
Exceptions
Type | Condition |
---|---|
ArgumentException | obj is non-null but does not refer to an instance of LocalTime. |
ISerializable.GetObjectData(SerializationInfo, StreamingContext)
Implementation of System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext).
Since 1.2.x
Availability net45
Declaration
[SecurityCritical]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | The System.Runtime.Serialization.SerializationInfo to populate with data. |
StreamingContext | context | The destination for this serialization. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | info is null. |
IXmlSerializable.GetSchema()
Since 1.2.x
Availability net45, netstandard1.3
Declaration
XmlSchema IXmlSerializable.GetSchema()
Returns
Type | Description |
---|---|
XmlSchema |
IXmlSerializable.ReadXml(XmlReader)
Since 1.2.x
Availability net45, netstandard1.3
Declaration
void IXmlSerializable.ReadXml(XmlReader reader)
Parameters
Type | Name | Description |
---|---|---|
XmlReader | reader |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | reader is null. |
IXmlSerializable.WriteXml(XmlWriter)
Since 1.2.x
Availability net45, netstandard1.3
Declaration
void IXmlSerializable.WriteXml(XmlWriter writer)
Parameters
Type | Name | Description |
---|---|---|
XmlWriter | writer |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | writer is null. |
Implements
System.IEquatable<T>
System.IComparable<T>
System.IFormattable
System.IComparable
System.Xml.Serialization.IXmlSerializable
System.Runtime.Serialization.ISerializable