|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.util.value.LongValue
org.apache.wicket.util.time.Time
public final class Time
An immutable Time class that represents a specific point in time. The underlying
representation is a long value which holds a number of milliseconds since January 1,
1970, 0:00 GMT. To represent a duration of time, such as "6 seconds", use the
Duration class. To represent a time period with a start and end time, use the
TimeFrame class. To represent a time of day, use the TimeOfDay class.
| Field Summary | |
|---|---|
static Time |
START_OF_UNIX_TIME
the beginning of UNIX time: January 1, 1970, 0:00 GMT. |
| Fields inherited from class org.apache.wicket.util.value.LongValue |
|---|
value |
| Method Summary | |
|---|---|
Time |
add(Duration duration)
Adds the given Duration to this Time object, moving the time into
the future. |
boolean |
after(org.apache.wicket.util.time.AbstractTimeValue that)
Returns true if this Time value is after the given
Time argument's value. |
boolean |
before(org.apache.wicket.util.time.AbstractTimeValue that)
Returns true if this Time value is before the given
Time argument's value. |
Duration |
elapsedSince()
Calculates the amount of time that has elapsed since this Time value. |
Duration |
fromNow()
Retrieves the Duration from now to this Time value. |
int |
get(java.util.Calendar calendar,
int field)
Retrieves the value of a field from the given Calendar. |
int |
get(int field)
Retrieves the value of a field. |
int |
getDayOfMonth()
Retrieves the day of month field of the current Calendar. |
int |
getDayOfMonth(java.util.Calendar calendar)
Retrieves the day of month field of the given Calendar. |
int |
getHour()
Retrieves the hour field of the current Calendar. |
int |
getHour(java.util.Calendar calendar)
Retrieves the hour field of the given Calendar. |
long |
getMilliseconds()
Retrieves the number of milliseconds in this Time value. |
int |
getMinute()
Retrieves the minute field of the current Calendar. |
int |
getMinute(java.util.Calendar calendar)
Retrieves the minute field of the given Calendar. |
int |
getMonth()
Retrieves the month field of the current Calendar. |
int |
getMonth(java.util.Calendar calendar)
Retrieves the month field of the given Calendar. |
int |
getSecond()
Retrieves the seconds field of the current Calendar. |
int |
getSecond(java.util.Calendar calendar)
Retrieves the seconds field of the given Calendar. |
int |
getYear()
Retrieves the year field of the current Calendar. |
int |
getYear(java.util.Calendar calendar)
Retrieves the year field of the given Calendar. |
static Time |
milliseconds(long time)
Retrieves a Time instance based on the given milliseconds. |
static Time |
now()
Retrieves a Time instance based on the current time. |
static Time |
parseDate(java.util.Calendar calendar,
java.lang.String string)
Retrieves a Time instance by parsing 'yyyy.MM.dd' format. |
static Time |
parseDate(java.lang.String string)
Retrieves a Time instance by parsing 'yyyy.MM.dd' format using a local time
Calendar. |
Time |
subtract(Duration duration)
Subtracts the given Duration from this Time object, moving the time
into the past. |
Duration |
subtract(Time that)
Subtract time from this and returns the difference as a Duration object. |
java.util.Date |
toDate()
Retrieves a Date object for this Time object. |
java.lang.String |
toDateString()
Converts this Time value to a date String using the date formatter
'yyyy.MM.dd'. |
java.lang.String |
toDateString(java.util.Calendar calendar)
Converts this Time value to a date String using the formatter
'yyyy.MM.dd'. |
java.lang.String |
toString()
Converts this Time value to a String suitable for use in a file
system name. |
java.lang.String |
toString(java.util.Calendar calendar,
java.lang.String format)
Converts this Time object to a String using the given
Calendar and format. |
java.lang.String |
toString(java.lang.String format)
Converts this Time value to a String using the given format. |
java.lang.String |
toTimeString()
Converts this Time to a time String using the formatter 'h.mma'. |
java.lang.String |
toTimeString(java.util.Calendar calendar)
Converts this Time to a Date String using the Date
formatter 'h.mma'. |
static Time |
valueOf(java.util.Calendar calendar,
java.lang.String string)
Retrieves a Time instance by parsing 'yyyy.MM.dd-h.mma' format. |
static Time |
valueOf(java.util.Calendar calendar,
TimeOfDay timeOfDay)
Retrieves a Time instance based on the given Calendar and
TimeOfDay objects. |
static Time |
valueOf(java.util.Date date)
Retrieves a Time instance based on the given Date object. |
static Time |
valueOf(long time)
Retrieves a Time instance based on the given milliseconds. |
static Time |
valueOf(java.lang.String string)
Retrieves a Time instance by parsing 'yyyy.MM.dd-h.mma' format. |
static Time |
valueOf(java.lang.String string,
java.lang.String pattern)
Retrieves a Time instance by parsing 'pattern' format. |
static Time |
valueOf(TimeOfDay timeOfDay)
Retrieves a Time instance based on the given TimeOfDay object. |
| Methods inherited from class org.apache.wicket.util.value.LongValue |
|---|
compareTo, equals, greaterThan, greaterThan, hashCode, lessThan, lessThan |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Time START_OF_UNIX_TIME
| Method Detail |
|---|
public static Time milliseconds(long time)
Time instance based on the given milliseconds.
time - the time value in milliseconds since START_OF_UNIX_TIME
Timepublic static Time now()
Time instance based on the current time.
Time
public static Time parseDate(java.util.Calendar calendar,
java.lang.String string)
throws java.text.ParseException
Time instance by parsing 'yyyy.MM.dd' format.
calendar - the Calendar to use when parsing date Stringstring - the String to parse
java.text.ParseException
public static Time parseDate(java.lang.String string)
throws java.text.ParseException
Time instance by parsing 'yyyy.MM.dd' format using a local time
Calendar.
string - the String to parse
java.text.ParseException
public static Time valueOf(java.util.Calendar calendar,
java.lang.String string)
throws java.text.ParseException
Time instance by parsing 'yyyy.MM.dd-h.mma' format.
calendar - the Calendar to use when parsing the Stringstring - the String to parse
Time value
java.text.ParseException
public static Time valueOf(java.util.Calendar calendar,
TimeOfDay timeOfDay)
Time instance based on the given Calendar and
TimeOfDay objects.
calendar - the Calendar to usetimeOfDay - the time of day
Time value for the time of day todaypublic static Time valueOf(java.util.Date date)
Time instance based on the given Date object.
date - a java.util.Date object
Time objectpublic static Time valueOf(long time)
Time instance based on the given milliseconds.
time - the Time value in milliseconds since START_OF_UNIX_TIME
Time object
public static Time valueOf(java.lang.String string)
throws java.text.ParseException
Time instance by parsing 'yyyy.MM.dd-h.mma' format.
string - the String to parse
Time instance
java.text.ParseException
public static Time valueOf(java.lang.String string,
java.lang.String pattern)
throws java.text.ParseException
Time instance by parsing 'pattern' format.
string - inputpattern - the pattern to parse
Time instance that resulted from parsing the given String
java.text.ParseExceptionpublic static Time valueOf(TimeOfDay timeOfDay)
Time instance based on the given TimeOfDay object.
timeOfDay - the time of day in local time
Time value for the time of day todaypublic Time add(Duration duration)
Duration to this Time object, moving the time into
the future.
duration - the Duration to add
Time + Durationpublic Duration elapsedSince()
Time value.
Time value
java.lang.IllegalStateException - thrown if this Time value is in the futurepublic Duration fromNow()
Duration from now to this Time value. If this
Time value is in the past, then the Duration returned will be
negative. Otherwise, it will be the number of milliseconds from now to this Time
.
Duration from now to this Time value
public int get(java.util.Calendar calendar,
int field)
Calendar.
calendar - the Calendar to usefield - the Calendar field to get
Calendarpublic int get(int field)
field - the Calendar field to get
public int getDayOfMonth()
Calendar.
public int getDayOfMonth(java.util.Calendar calendar)
Calendar.
calendar - the Calendar to get the field value from
public int getHour()
Calendar.
public int getHour(java.util.Calendar calendar)
Calendar.
calendar - the Calendar to get the field value from
public int getMinute()
Calendar.
public int getMinute(java.util.Calendar calendar)
Calendar.
calendar - the Calendar from which to get the field value
public int getMonth()
Calendar.
public int getMonth(java.util.Calendar calendar)
Calendar.
calendar - the Calendar from which to get the field value
public int getSecond()
Calendar.
public int getSecond(java.util.Calendar calendar)
Calendar.
calendar - the Calendar from which to get the field value
public int getYear()
Calendar.
public int getYear(java.util.Calendar calendar)
Calendar.
calendar - the Calendar from which to get the field value
public Time subtract(Duration duration)
Duration from this Time object, moving the time
into the past.
duration - the Duration to subtract
public Duration subtract(Time that)
Duration object.
that - the time to subtract
Duration between this and that timepublic java.util.Date toDate()
Date object for this Time object. A new
Date object is always returned rather than attempting to cache a date since
Date is mutable.
Time object as a mutable java.util.Date
objectpublic java.lang.String toDateString()
Time value to a date String using the date formatter
'yyyy.MM.dd'.
public java.lang.String toDateString(java.util.Calendar calendar)
Time value to a date String using the formatter
'yyyy.MM.dd'.
calendar - the Calendar to use in the conversion
Stringpublic java.lang.String toString()
Time value to a String suitable for use in a file
system name.
Time value as a formatted String
public java.lang.String toString(java.util.Calendar calendar,
java.lang.String format)
Time object to a String using the given
Calendar and format.
calendar - the Calendar to use in the conversionformat - the format to use
Time value as a formatted Stringpublic java.lang.String toString(java.lang.String format)
Time value to a String using the given format.
format - the format to use
Time value as a formatted stringpublic final boolean after(org.apache.wicket.util.time.AbstractTimeValue that)
true if this Time value is after the given
Time argument's value.
that - the AbstractTimeValue to compare with
true if this Time value is after that
Time valuepublic final boolean before(org.apache.wicket.util.time.AbstractTimeValue that)
true if this Time value is before the given
Time argument's value.
that - the AbstractTimeValue to compare with
true if this Time value is before that
Time valuepublic final java.lang.String toTimeString()
Time to a time String using the formatter 'h.mma'.
Time Stringpublic final java.lang.String toTimeString(java.util.Calendar calendar)
Time to a Date String using the Date
formatter 'h.mma'.
calendar - the Calendar to use in the conversion
Date Stringpublic final long getMilliseconds()
Time value.
Time value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||