TimeSpan class
The Class TimeSpan.
- Implemented types
Constructors
- TimeSpan(int time)
- Creates a new instance of TimeSpan based on the number of milliseconds entered.
- TimeSpan.fromUnitAndValue(int units, int value)
- Creates a new TimeSpan object based on the unit and value entered.
Properties
- Days → int
-
Gets the number of days (truncated).
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- Hours → int
-
Gets the number of hours (truncated).
no setter
- Milliseconds → int
-
Gets the number of milliseconds.
no setter
- Minutes → int
-
Gets the number of minutes (truncated).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- Seconds → int
-
Gets the number of seconds (truncated).
no setter
- time ↔ int
-
The time.
getter/setter pair
- TotalSeconds → double
-
Gets the number of seconds including fractional seconds.
no setter
Methods
-
compareTo(
TimeSpan o) → int -
Compares this object with the specified object for order. Returns a
negative integer, zero, or a positive integer as this object is less
than, equal to, or greater than the specified object. Comparison is based
on the number of milliseconds in this TimeSpan.
override
-
duration(
) → TimeSpan - Returns a TimeSpan whose value is the absolute value of this TimeSpan.
-
equals(
Object obj) → bool - Indicates whether some other object is "equal to" this one. Comparison is based on the number of milliseconds in this TimeSpan.
-
getTotalDays(
) → double - Gets the number of days including fractional days.
-
getTotalHours(
) → double - Gets the number of hours including fractional hours.
-
getTotalMilliseconds(
) → int - Gets the number of milliseconds.
-
getTotalMinutes(
) → double - Gets the number of minutes including fractional minutes.
-
isNegative(
) → bool - Indicates whether the value of the TimeSpan is negative.
-
isPositive(
) → bool - Indicates whether the value of the TimeSpan is positive.
-
isZero(
) → bool - Indicates whether the value of the TimeSpan is zero.
-
negate(
) → TimeSpan - Returns a TimeSpan whose value is the negated value of this TimeSpan.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns a string representation of the object in the format.
"
-
d.hh:mm:ss.ff" where "-" is an optional sign for negative TimeSpan values, the "d" component is days, "hh" is hours, "mm" is minutes, "ss" is seconds, and "ff" is millisecondsoverride
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- serialVersionUID → int
-
Constant serialized ID used for compatibility.
final
- ZERO → TimeSpan
-
Represents the Maximum TimeSpan value.
static final TimeSpan MAX_VALUE = new TimeSpan(Long.MAX_VALUE);
Represents the Minimum TimeSpan value.
static final TimeSpan MIN_VALUE = new TimeSpan(Long.MIN_VALUE);
Represents the TimeSpan with a value of zero.
final
Static Methods
Constants
- DAYS → const int
- Constant for days unit and conversion.
- HOURS → const int
- Constant for hours unit and conversion.
- MILLISECONDS → const int
- Constant for milliseconds unit and conversion.
- MINUTES → const int
- Constant for minutes unit and conversion.
- SECONDS → const int
- Constant for seconds unit and conversion.