Noda Time
Duration Structure
NamespacesNodaTimeDuration
Represents a fixed (and calendar-independent) length of time.
Declaration Syntax
C#Visual BasicVisual C++
public struct Duration : IEquatable<Duration>, 
	IComparable<Duration>, IComparable
Public Structure Duration _
	Implements IEquatable(Of Duration), IComparable(Of Duration),  _
	IComparable
public value class Duration : IEquatable<Duration>, 
	IComparable<Duration>, IComparable
Members
All MembersMethodsPropertiesFields



IconMemberDescription
Add(Duration, Duration)
Adds one duration to another. Friendly alternative to operator+().

Addition(Duration, Duration)
Implements the operator + (addition).

CompareTo(Duration)
Compares the current object with another object of the same type.

Divide(Duration, Int64)
Divides a duration by a number. Friendly alternative to operator/().

Division(Duration, Int64)
Implements the operator / (division).

Epsilon
Represents the Duration value equals to 1 tick; the smallest amount by which an instant can vary. This field is read-only.

Equality(Duration, Duration)
Implements the operator == (equality).

Equals(Object)
Determines whether the specified Object is equal to this instance.
(Overrides ValueType.Equals(Object).)
Equals(Duration)
Indicates whether the current object is equal to another object of the same type.

Finalize()()()()
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
FromHours(Int64)
Returns a Duration that represents the given number of hours.

FromMilliseconds(Int64)
Returns a Duration that represents the given number of milliseconds.

FromMinutes(Int64)
Returns a Duration that represents the given number of minutes.

FromSeconds(Int64)
Returns a Duration that represents the given number of seconds.

FromStandardDays(Int64)
Returns a Duration that represents the given number of days, assuming a 'standard' 24-hour day.

FromStandardWeeks(Int64)
Returns a Duration that represents the given number of weeks, assuming a 'standard' week consisting of seven 24-hour days.

FromTicks(Int64)
Returns a Duration that represents the given number of ticks.

FromTimeSpan(TimeSpan)
Returns a Duration that represents the same number of ticks as the given TimeSpan.

GetHashCode()()()()
Returns a hash code for this instance.
(Overrides ValueType.GetHashCode()()()().)
GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
GreaterThan(Duration, Duration)
Implements the operator > (greater than).

GreaterThanOrEqual(Duration, Duration)
Implements the operator >= (greater than or equal).

Inequality(Duration, Duration)
Implements the operator != (inequality).

LessThan(Duration, Duration)
Implements the operator < (less than).

LessThanOrEqual(Duration, Duration)
Implements the operator <= (less than or equal).

MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Minus(Duration)
Returns the result of subtracting another duration from this one, for a fluent alternative to operator-().

Multiply(Duration, Int64)
Implements the operator * (multiplication).

Multiply(Int64, Duration)
Implements the operator * (multiplication).

Multiply(Duration, Int64)
Multiplies a duration by a number. Friendly alternative to operator*().

Multiply(Int64, Duration)
Multiplies a duration by a number. Friendly alternative to operator*().

Negate(Duration)
Implements a friendly alternative to the unary negation operator.

Plus(Duration)
Returns the result of adding another duration to this one, for a fluent alternative to operator+().

Subtract(Duration, Duration)
Subtracts one duration from another. Friendly alternative to operator-().

Subtraction(Duration, Duration)
Implements the operator - (subtraction).

Ticks
The total number of ticks in the duration.

ToString()()()()
Gets the value as a String including the number of ticks represented by this duration.
(Overrides ValueType.ToString()()()().)
ToTimeSpan()()()()
Returns a TimeSpan that represents the same number of ticks as this Duration.

UnaryNegation(Duration)
Implements the unary negation operator.

Zero
Represents the zero Duration value. This field is read-only.

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 an earlier Instant from a later 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.

Thread Safety
This type is an immutable value type. See the thread safety section of the user guide for more information.

Assembly: NodaTime (Module: NodaTime) Version: 1.0.0.0 (1.0.1)