public final class TimeSpan
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static TimeSpan |
MAX_VALUE
The largest value of a TimeSpan (DoubleProperty.MAX_VALUE)
|
static TimeSpan |
MIN_VALUE
The smallest value of a TimeSpan (DoubleProperty.MIN_VALUE)
|
static TimeSpan |
ZERO
A TimeSpan of value 0.0
|
| Modifier and Type | Method and Description |
|---|---|
TimeSpan |
add(TimeSpan b)
returns a TimeSpan composed from the addition of a TimeSpan to this
instance
|
static TimeSpan |
add(TimeSpan a,
TimeSpan b)
returns a TimeSpan created from the addition of 2 Timespan instances
|
static int |
compare(TimeSpan a,
TimeSpan b)
returns the result of a comparison between two TimeSpan's
|
int |
compareTo(TimeSpan b)
compares a TimeSpan to this instance
|
TimeSpan |
duration()
returns the real duration in time for this TimeSpan, i.e.
|
boolean |
equals(java.lang.Object obj)
Compare this TimeSpan to another one.
|
static TimeSpan |
fromDays(double days)
returns a time span created from a specified number of days
|
static TimeSpan |
fromDays(int days,
int hrs,
int min,
int sec)
returns a TimeSpan created from the specified number of days, hours,
minutes and seconds
|
static TimeSpan |
fromDays(int days,
int hrs,
int min,
int sec,
int msec)
returns a TimeSpan created from the specified number of days, hours,
minutes, seconds and milliseconds
|
static TimeSpan |
fromHours(double hours)
returns a time span created from a specified number of hours
|
static TimeSpan |
fromHours(int hrs,
int min,
int sec)
returns a TimeSpan created from the specified number of hours, minutes
and seconds
|
static TimeSpan |
fromHours(int hrs,
int min,
int sec,
int msec)
returns a TimeSpan created from the specified number of hours, minutes,
seconds and milliseconds
|
static TimeSpan |
fromMilliseconds(double milliseconds)
returns a time span created from a specified number of milliseconds
|
static TimeSpan |
fromMinutes(double minutes)
returns a time span created from a specified number of minutes
|
static TimeSpan |
fromMonths(double months)
returns a time span created from a specified number of months
|
static TimeSpan |
fromSeconds(double seconds)
returns a time span created from a specified number of seconds
|
static TimeSpan |
fromTicks(long ticks)
returns a time span created from a specified number of ticks
|
static TimeSpan |
fromWeeks(double weeks)
returns a time span created from a specified number of weeks
|
static TimeSpan |
fromYears(double years)
returns a time span created from a specified number of years
|
int |
getDaysPart()
returns the number of whole (24 hour) days in this TimeSpan
|
int |
getHoursPart()
returns the number of whole hours in this TimeSpan
|
int |
getMillisecondsPart()
returns the number of whole milliseconds in this TimeSpan
|
int |
getMinutesPart()
returns the number of whole minutes in this TimeSpan
|
int |
getSecondsPart()
returns the number of whole seconds in this TimeSpan
|
int |
hashCode()
Gets a unique hash for this TimeSpan
|
boolean |
isEqualTo(TimeSpan t)
Compare this TimeSpan to another one.
|
TimeSpan |
negate()
returns a TimeSpan composed by subtracting this TimeSpan instance from
ZERO
|
static TimeSpan |
parse(java.lang.String timespan)
Returns a TimeSpan composed by parsing the specified String
representation.
|
TimeSpan |
subtract(TimeSpan b)
returns a TimeSpan composed from the subtraction of a TimeSpan from this
instance
|
static TimeSpan |
subtract(TimeSpan a,
TimeSpan b)
returns a TimeSpan created from the subtraction of 2 Timespan instances
|
double |
toDays()
returns the number of days in this TimeSpan
|
double |
toHours()
returns the number of hours in this TimeSpan
|
double |
toMilliseconds()
returns the number of milliseconds in this TimeSpan
|
double |
toMinutes()
returns the number of minutes in this TimeSpan
|
double |
toMonths()
returns the number of months in this TimeSpan in 30 day increments.
|
double |
toSeconds()
returns the number of seconds in this TimeSpan
|
java.lang.String |
toString()
returns a string representation of this instance in the form
"[-][d.]hh:mm:ss[.ff]"
|
long |
toTicks()
returns the number of ticks in this TimeSpan (a tick is 100 nanoseconds)
|
double |
toWeeks()
returns the number of weeks in this TimeSpan
|
double |
toYears()
returns the number of years in this TimeSpan in 365 day increments.
|
public static final TimeSpan MIN_VALUE
public static final TimeSpan MAX_VALUE
public static final TimeSpan ZERO
public static TimeSpan add(TimeSpan a, TimeSpan b)
a - TimeSpanb - TimeSpanpublic static TimeSpan subtract(TimeSpan a, TimeSpan b)
a - TimeSpanb - TimeSpanpublic static TimeSpan fromYears(double years)
years - double (in 365 day increments). This transformation may be
lossypublic static TimeSpan fromMonths(double months)
months - double (in 30 day increments). This transformation may be
lossypublic static TimeSpan fromWeeks(double weeks)
weeks - double (in 7 day increments)public static TimeSpan fromDays(double days)
days - doublepublic static TimeSpan fromHours(double hours)
hours - doublepublic static TimeSpan fromMinutes(double minutes)
minutes - doublepublic static TimeSpan fromSeconds(double seconds)
seconds - doublepublic static TimeSpan fromMilliseconds(double milliseconds)
milliseconds - doublepublic static TimeSpan fromTicks(long ticks)
ticks - long (1 tick = 100 nanosecs)public static TimeSpan fromHours(int hrs, int min, int sec)
hrs - intmin - intsec - intpublic static TimeSpan fromHours(int hrs, int min, int sec, int msec)
hrs - intmin - intsec - intmsec - intpublic static TimeSpan fromDays(int days, int hrs, int min, int sec)
days - inthrs - intmin - intsec - intpublic static TimeSpan fromDays(int days, int hrs, int min, int sec, int msec)
days - inthrs - intmin - intsec - intmsec - intpublic double toYears()
public double toMonths()
public double toWeeks()
public double toDays()
public double toHours()
public double toMinutes()
public double toSeconds()
public double toMilliseconds()
public long toTicks()
public int getDaysPart()
public int getHoursPart()
public int getMinutesPart()
public int getSecondsPart()
public int getMillisecondsPart()
public TimeSpan add(TimeSpan b)
b - the TimeSpan to add to this instancepublic TimeSpan subtract(TimeSpan b)
b - the TimeSpan to subtract from this instancepublic static int compare(TimeSpan a, TimeSpan b)
a - TimeSpanb - TimeSpanpublic int compareTo(TimeSpan b)
b - TimeSpanpublic TimeSpan negate()
public TimeSpan duration()
public java.lang.String toString()
toString in class java.lang.ObjectTimeSpanFormatter.format(TimeSpan)public static TimeSpan parse(java.lang.String timespan)
timespan - a String representation of a TimeSpanpublic boolean isEqualTo(TimeSpan t)
t - The TimeSpan to be compared to this one.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - The TimeSpan to be compared to this one.public int hashCode()
hashCode in class java.lang.ObjectStarTeam SDK 17.0, Build 34
Copyright © 2019 Micro Focus or one of its affiliates. All rights reserved.