|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wicket.util.value.LongValue 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 time duration, 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 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(wicket.util.time.AbstractTimeValue that)
|
boolean |
before(wicket.util.time.AbstractTimeValue that)
|
Duration |
elapsedSince()
|
Duration |
fromNow()
Gets the duration from now to this time value. |
int |
get(java.util.Calendar calendar,
int field)
Gets the value of a field from the given calendar. |
int |
get(int field)
Gets the value of a field. |
int |
getDayOfMonth()
Gets the day of month field of the current calendar. |
int |
getDayOfMonth(java.util.Calendar calendar)
Gets the day of month field of the given calendar. |
int |
getHour()
Gets the hour field of the current calendar. |
int |
getHour(java.util.Calendar calendar)
Gets the hour field of the given calendar. |
long |
getMilliseconds()
|
int |
getMinute()
Gets the minute field of the current calendar. |
int |
getMinute(java.util.Calendar calendar)
Gets the minute field of the given calendar. |
int |
getMonth()
Gets the month field of the current calendar. |
int |
getMonth(java.util.Calendar calendar)
Gets the month field of the given calendar. |
int |
getSecond()
Gets the second field of the current calendar. |
int |
getSecond(java.util.Calendar calendar)
Gets the second field of the given calendar. |
int |
getYear()
Gets the year field of the current calendar. |
int |
getYear(java.util.Calendar calendar)
Gets the year field of the given calendar. |
static Time |
milliseconds(long time)
Gets a Time instance based on the given miliseconds. |
static Time |
now()
Gets a Time instance based on the current time. |
static Time |
parseDate(java.util.Calendar calendar,
java.lang.String string)
Gets time by parsing 'yyyy.MM.dd' format. |
static Time |
parseDate(java.lang.String string)
Gets time by parsing 'yyyy.MM.dd' format using a localtime calendar. |
Time |
subtract(Duration duration)
Adds the given duration to this time object, moving the time into the future. |
Duration |
subtract(Time that)
Subtract time from this and returns the difference as a duration object. |
java.util.Date |
toDate()
Gets a Date object for this time object. |
java.lang.String |
toDateString()
Converts this time to a date string using the date formatter 'yyyy.MM.dd'. |
java.lang.String |
toDateString(java.util.Calendar calendar)
Converts this time to a date string using the formatter 'yyyy.MM.dd'. |
java.lang.String |
toString()
Converts this time to a string suitable for use in a filesystem name. |
java.lang.String |
toString(java.util.Calendar calendar,
java.lang.String format)
Converts this time to a string using the given calendar and format. |
java.lang.String |
toString(java.lang.String format)
Converts this time 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)
Gets time by parsing yyyy.MM.dd-h.mma format. |
static Time |
valueOf(java.util.Calendar calendar,
TimeOfDay timeOfDay)
Gets a Time instance based on the given calendar and TimeOfDay
objects. |
static Time |
valueOf(java.util.Date date)
Gets a Time instance based on the given date object. |
static Time |
valueOf(long time)
Gets a Time instance based on the given miliseconds. |
static Time |
valueOf(java.lang.String string)
Gets time by parsing yyyy.MM.dd-h.mma format. |
static Time |
valueOf(java.lang.String string,
java.lang.String pattern)
Gets time by parsing 'pattern' format. |
static Time |
valueOf(TimeOfDay timeOfDay)
Gets a Time instance based on the given TimeOfDay object. |
Methods inherited from class 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
- The time in milliseconds since START_OF_UNIX_TIME
public static Time now()
public static Time parseDate(java.util.Calendar calendar, java.lang.String string) throws java.text.ParseException
calendar
- The calendar to use when parsing date stringstring
- The string
java.text.ParseException
public static Time parseDate(java.lang.String string) throws java.text.ParseException
string
- The string
java.text.ParseException
public static Time valueOf(java.util.Calendar calendar, java.lang.String string) throws java.text.ParseException
calendar
- The calendar to use when parsing the stringstring
- The string
java.text.ParseException
public static Time valueOf(java.util.Calendar calendar, TimeOfDay timeOfDay)
TimeOfDay
objects.
calendar
- The calendar to usetimeOfDay
- The time of day
public static Time valueOf(java.util.Date date)
date
- A java.util.Date object
public static Time valueOf(long time)
time
- The time in milliseconds since START_OF_UNIX_TIME
public static Time valueOf(java.lang.String string) throws java.text.ParseException
string
- The string
java.text.ParseException
public static Time valueOf(java.lang.String string, java.lang.String pattern) throws java.text.ParseException
string
- inputpattern
- pattern to use
java.text.ParseException
public static Time valueOf(TimeOfDay timeOfDay)
TimeOfDay
object.
timeOfDay
- The time of day in localtime
public Time add(Duration duration)
duration
- The duration to add
public Duration elapsedSince()
java.lang.IllegalStateException
- Thrown if this time is in the futurepublic Duration fromNow()
public int get(java.util.Calendar calendar, int field)
calendar
- The calendar to usefield
- The calendar field to get
public int get(int field)
field
- The calendar field to get
public int getDayOfMonth()
public int getDayOfMonth(java.util.Calendar calendar)
calendar
- the calendar to get the field value from
public int getHour()
public int getHour(java.util.Calendar calendar)
calendar
- the calendar to get the field value from
public int getMinute()
public int getMinute(java.util.Calendar calendar)
calendar
- the calendar to get the field value from
public int getMonth()
public int getMonth(java.util.Calendar calendar)
calendar
- the calendar to get the field value from
public int getSecond()
public int getSecond(java.util.Calendar calendar)
calendar
- the calendar to get the field value from
public int getYear()
public int getYear(java.util.Calendar calendar)
calendar
- the calendar to get the field value from
public Time subtract(Duration duration)
duration
- The duration to add
public Duration subtract(Time that)
that
- The time to subtract
public java.util.Date toDate()
public java.lang.String toDateString()
public java.lang.String toDateString(java.util.Calendar calendar)
calendar
- The calendar to use in the conversion
public java.lang.String toString()
public java.lang.String toString(java.util.Calendar calendar, java.lang.String format)
calendar
- the calendar to useformat
- the format to use
public java.lang.String toString(java.lang.String format)
format
- the format to use
public final boolean after(wicket.util.time.AbstractTimeValue that)
that
- The time to compare with
public final boolean before(wicket.util.time.AbstractTimeValue that)
that
- The time to compare with
public final java.lang.String toTimeString()
public final java.lang.String toTimeString(java.util.Calendar calendar)
calendar
- The calendar to use in the conversion
public final long getMilliseconds()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |