Struct Duration
Implements
Inherited Members
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
[Serializable]
public struct Duration : IEquatable<Duration>, IComparable<Duration>, IComparable, IXmlSerializable, IFormattable, ISerializable
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Fields
Epsilon
Declaration
public static readonly Duration Epsilon
Field Value
Type  Description 

Duration 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Zero
Declaration
public static readonly Duration Zero
Field Value
Type  Description 

Duration 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Properties
Ticks
Declaration
public long Ticks { get; }
Property Value
Type  Description 

Int64 
Remarks
Methods
Add(Duration, Duration)
operator+()
.
Declaration
public static Duration Add(Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the sum of the given values. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
CompareTo(Duration)
Declaration
public int CompareTo(Duration other)
Parameters
Type  Name  Description 

Duration  other  An object to compare with this object. 
Returns
Type  Description  

Int32 
A 32bit signed integer that indicates the relative order of the objects being compared.
The return value has the following meanings:

Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Divide(Duration, Int64)
operator/()
.
Declaration
public static Duration Divide(Duration left, long right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Int64  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the result of dividing left by
right . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Equals(Duration)
Declaration
public bool Equals(Duration other)
Parameters
Type  Name  Description 

Duration  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
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
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
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
FromHours(Int64)
Declaration
public static Duration FromHours(long hours)
Parameters
Type  Name  Description 

Int64  hours  The number of hours. 
Returns
Type  Description 

Duration  A Duration representing the given number of hours. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
FromMilliseconds(Int64)
Declaration
public static Duration FromMilliseconds(long milliseconds)
Parameters
Type  Name  Description 

Int64  milliseconds  The number of milliseconds. 
Returns
Type  Description 

Duration  A Duration representing the given number of milliseconds. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
FromMinutes(Int64)
Declaration
public static Duration FromMinutes(long minutes)
Parameters
Type  Name  Description 

Int64  minutes  The number of minutes. 
Returns
Type  Description 

Duration  A Duration representing the given number of minutes. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
FromSeconds(Int64)
Declaration
public static Duration FromSeconds(long seconds)
Parameters
Type  Name  Description 

Int64  seconds  The number of seconds. 
Returns
Type  Description 

Duration  A Duration representing the given number of seconds. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
FromStandardDays(Int64)
Declaration
public static Duration FromStandardDays(long days)
Parameters
Type  Name  Description 

Int64  days  The number of days. 
Returns
Type  Description 

Duration  A Duration representing the given number of days. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
FromStandardWeeks(Int64)
Declaration
public static Duration FromStandardWeeks(long weeks)
Parameters
Type  Name  Description 

Int64  weeks  The number of weeks. 
Returns
Type  Description 

Duration  A Duration representing the given number of weeks. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
FromTicks(Int64)
Declaration
public static Duration FromTicks(long ticks)
Parameters
Type  Name  Description 

Int64  ticks  The number of ticks. 
Returns
Type  Description 

Duration  A Duration representing the given number of ticks. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
FromTimeSpan(TimeSpan)
Declaration
public static Duration FromTimeSpan(TimeSpan timeSpan)
Parameters
Type  Name  Description 

TimeSpan  timeSpan  The TimeSpan value to convert 
Returns
Type  Description 

Duration  A new Duration with the same number of ticks as the given TimeSpan. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
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
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Minus(Duration)
operator()
.
Declaration
public Duration Minus(Duration other)
Parameters
Type  Name  Description 

Duration  other  The duration to subtract 
Returns
Type  Description 

Duration  A new Duration representing the result of the subtraction. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Multiply(Duration, Int64)
operator*()
.
Declaration
public static Duration Multiply(Duration left, long right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Int64  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the product of the given values. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Multiply(Int64, Duration)
operator*()
.
Declaration
public static Duration Multiply(long left, Duration right)
Parameters
Type  Name  Description 

Int64  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the product of the given values. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Negate(Duration)
Declaration
public static Duration Negate(Duration duration)
Parameters
Type  Name  Description 

Duration  duration  Duration to negate 
Returns
Type  Description 

Duration  The negative value of this duration 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Plus(Duration)
operator+()
.
Declaration
public Duration Plus(Duration other)
Parameters
Type  Name  Description 

Duration  other  The duration to add 
Returns
Type  Description 

Duration  A new Duration representing the result of the addition. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Subtract(Duration, Duration)
operator()
.
Declaration
public static Duration Subtract(Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the difference of the given values. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
ToString()
Declaration
public override string ToString()
Returns
Type  Description 

String  A String that represents this instance. 
Overrides
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
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 pattern defined for the type of the IFormattable implementation. 
IFormatProvider  formatProvider  The IFormatProvider to use to format the value. or null to obtain the numeric format information from the current locale setting of the operating system. 
Returns
Type  Description 

String  A String containing the value of the current instance in the specified format. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
ToTimeSpan()
Declaration
public TimeSpan ToTimeSpan()
Returns
Type  Description 

TimeSpan  A new TimeSpan with the same number of ticks as this Duration. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Operators
Addition(Duration, Duration)
Declaration
public static Duration operator +(Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the sum of the given values. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Division(Duration, Int64)
Declaration
public static Duration operator /(Duration left, long right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Int64  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the result of dividing left by
right . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Equality(Duration, Duration)
Declaration
public static bool operator ==(Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Boolean  true if values are equal to each other, otherwise false . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
GreaterThan(Duration, Duration)
Declaration
public static bool operator>(Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Boolean  true if the left value is greater than the right value, otherwise false . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
GreaterThanOrEqual(Duration, Duration)
Declaration
public static bool operator >=(Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Boolean  true if the left value is greater than or equal to the right value, otherwise false . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Inequality(Duration, Duration)
Declaration
public static bool operator !=(Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Boolean  true if values are not equal to each other, otherwise false . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
LessThan(Duration, Duration)
Declaration
public static bool operator <(Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Boolean  true if the left value is less than the right value, otherwise false . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
LessThanOrEqual(Duration, Duration)
Declaration
public static bool operator <=(Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Boolean  true if the left value is less than or equal to the right value, otherwise false . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Multiply(Duration, Int64)
Declaration
public static Duration operator *(Duration left, long right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Int64  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the result of multiplying left by
right . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Multiply(Int64, Duration)
Declaration
public static Duration operator *(long left, Duration right)
Parameters
Type  Name  Description 

Int64  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the result of multiplying left by
right . 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
Subtraction(Duration, Duration)
Declaration
public static Duration operator (Duration left, Duration right)
Parameters
Type  Name  Description 

Duration  left  The left hand side of the operator. 
Duration  right  The right hand side of the operator. 
Returns
Type  Description 

Duration  A new Duration representing the difference of the given values. 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
UnaryNegation(Duration)
Declaration
public static Duration operator (Duration duration)
Parameters
Type  Name  Description 

Duration  duration  Duration to negate 
Returns
Type  Description 

Duration  The negative value of this duration 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
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 instant with another one; see CompareTo(Duration) for general details.
If obj is null, this method returns a value greater than 0.

Remarks
Exceptions
Type  Condition 

ArgumentException  obj is nonnull but does not refer to an instance of Duration. 
ISerializable.GetObjectData(SerializationInfo, StreamingContext)
Declaration
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
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
IXmlSerializable.GetSchema()
Declaration
XmlSchema IXmlSerializable.GetSchema()
Returns
Type  Description 

XmlSchema 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
IXmlSerializable.ReadXml(XmlReader)
Declaration
void IXmlSerializable.ReadXml(XmlReader reader)
Parameters
Type  Name  Description 

XmlReader  reader 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.
IXmlSerializable.WriteXml(XmlWriter)
Declaration
void IXmlSerializable.WriteXml(XmlWriter writer)
Parameters
Type  Name  Description 

XmlWriter  writer 
Remarks
A duration is a length of time defined by an integral number of 'ticks', where a tick is equal to 100 nanoseconds. There are 10,000 ticks in a millisecond. Although durations are usually used with a positive number of ticks, negative durations are valid, and may occur naturally when e.g. subtracting a later Instant from an earlier one.
A duration represents a fixed length of elapsed time along the time line that occupies the same amount of time regardless of when it is applied. In contrast, Period represents a period of time in calendrical terms (hours, days, and so on) that may vary in elapsed time when applied.
In general, use Duration to represent durations applied to global types like Instant
and ZonedDateTime; use Period
to represent a period applied to local types like
LocalDateTime.