|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.data.Duration
public class Duration
A representation of a length of time.
This class allows you to specify durations in a variety of units and get them out in a similar variety without worrying about whether your time is in milliseconds or seconds or fortnights or whatnot. Base storage is in milliseconds. I suppose smaller durations might be interesting to some people.
Copyright 2008 Partner Software, Inc.
DateAndTime,
Date,
Time| Field Summary | |
|---|---|
static long |
DAYS_TO_MILLIS
|
static long |
HOURS_TO_MILLIS
|
static double |
MILLIS_TO_DAYS
|
static double |
MILLIS_TO_HOURS
|
static double |
MILLIS_TO_MINUTES
|
static double |
MILLIS_TO_SECONDS
|
static long |
MINUTES_TO_MILLIS
|
static long |
SECONDS_TO_MILLIS
|
| Constructor Summary | |
|---|---|
Duration(java.lang.String value)
|
|
| Method Summary | |
|---|---|
int |
compareTo(Duration nother)
|
boolean |
equals(java.lang.Object nother)
|
static Duration |
forDays(double days)
|
static Duration |
forHours(double hours)
|
static Duration |
forMilliseconds(long millis)
|
static Duration |
forMinutes(double minutes)
|
static Duration |
forSeconds(double seconds)
|
static Duration |
forString(java.lang.String value)
|
double |
getDays()
|
int |
getDaysPart()
Returns the truncated days amount - useful when breaking the duration up into hours minutes seconds etc. |
double |
getHours()
|
int |
getHoursPart()
Returns the truncated hours amount - useful when breaking the duration up into hours minutes seconds etc. |
long |
getMilliseconds()
|
int |
getMillisecondsPart()
Returns the truncated millisecond amount - useful when breaking the duration up into hours minutes seconds etc. |
double |
getMinutes()
|
int |
getMinutesPart()
Returns the truncated minutes amount - useful when breaking the duration up into hours minutes seconds etc. |
double |
getSeconds()
|
int |
getSecondsPart()
Returns the truncated seconds amount - useful when breaking the duration up into hours minutes seconds etc. |
java.util.Date |
toJavaUtilDate()
Returns this time represented as a Date object. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long SECONDS_TO_MILLIS
public static final long MINUTES_TO_MILLIS
public static final long HOURS_TO_MILLIS
public static final long DAYS_TO_MILLIS
public static final double MILLIS_TO_SECONDS
public static final double MILLIS_TO_MINUTES
public static final double MILLIS_TO_HOURS
public static final double MILLIS_TO_DAYS
| Constructor Detail |
|---|
public Duration(java.lang.String value)
| Method Detail |
|---|
public static Duration forMilliseconds(long millis)
public static Duration forSeconds(double seconds)
public static Duration forMinutes(double minutes)
public static Duration forHours(double hours)
public static Duration forDays(double days)
public static Duration forString(java.lang.String value)
public long getMilliseconds()
public double getSeconds()
public double getMinutes()
public double getHours()
public double getDays()
public int getMillisecondsPart()
public int getSecondsPart()
public int getMinutesPart()
public int getHoursPart()
public int getDaysPart()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Date toJavaUtilDate()
Date object.
public boolean equals(java.lang.Object nother)
equals in class java.lang.Objectpublic int compareTo(Duration nother)
compareTo in interface java.lang.Comparable<Duration>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||