Package org.apache.wicket.util.time
Class Time
- java.lang.Object
-
- org.apache.wicket.util.value.LongValue
-
- org.apache.wicket.util.time.Time
-
- All Implemented Interfaces:
Serializable
,Comparable<LongValue>
@Deprecated public final class Time extends LongValue
Deprecated.Since Wicket 9 this class is obsolete and no more used. It will be removed in Wicket 10. UseInstant
insteadAn immutableTime
class that represents a specific point in time. The underlying representation is along
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 theDuration
class. To represent a time period with a start and end time, use theTimeFrame
class. To represent a time of day, use theTimeOfDay
class.- Since:
- 1.2.6
- Author:
- Jonathan Locke
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Time
add(Duration duration)
Deprecated.Adds the givenDuration
to thisTime
object, moving the time into the future.boolean
after(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrue
if thisTime
value is after the givenTime
argument's value.boolean
before(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrue
if thisTime
value is before the givenTime
argument's value.Duration
elapsedSince()
Deprecated.Calculates the amount of time that has elapsed since thisTime
value.Duration
fromNow()
Deprecated.Retrieves theDuration
from now to thisTime
value.int
get(int field)
Deprecated.Retrieves the value of a field.int
get(Calendar calendar, int field)
Deprecated.Retrieves the value of a field from the givenCalendar
.int
getDayOfMonth()
Deprecated.Retrieves the day of month field of the currentCalendar
.int
getDayOfMonth(Calendar calendar)
Deprecated.Retrieves the day of month field of the givenCalendar
.int
getHour()
Deprecated.Retrieves the hour field of the currentCalendar
.int
getHour(Calendar calendar)
Deprecated.Retrieves the hour field of the givenCalendar
.long
getMilliseconds()
Deprecated.Retrieves the number of milliseconds in thisTime
value.int
getMinute()
Deprecated.Retrieves the minute field of the currentCalendar
.int
getMinute(Calendar calendar)
Deprecated.Retrieves the minute field of the givenCalendar
.int
getMonth()
Deprecated.Retrieves the month field of the currentCalendar
.int
getMonth(Calendar calendar)
Deprecated.Retrieves the month field of the givenCalendar
.int
getSecond()
Deprecated.Retrieves the seconds field of the currentCalendar
.int
getSecond(Calendar calendar)
Deprecated.Retrieves the seconds field of the givenCalendar
.int
getYear()
Deprecated.Retrieves the year field of the currentCalendar
.int
getYear(Calendar calendar)
Deprecated.Retrieves the year field of the givenCalendar
.static Time
millis(long time)
Deprecated.Retrieves aTime
instance based on the given milliseconds.static Time
now()
Deprecated.Retrieves aTime
instance based on the current time.static Time
parseDate(String string)
Deprecated.Retrieves aTime
instance by parsing 'yyyy.MM.dd' format using a local timeCalendar
.static Time
parseDate(Calendar calendar, String string)
Deprecated.Retrieves aTime
instance by parsing 'yyyy.MM.dd' format.Time
subtract(Duration duration)
Deprecated.Subtracts the givenDuration
from thisTime
object, moving the time into the past.Duration
subtract(Time that)
Deprecated.Subtract time from this and returns the difference as aDuration
object.Date
toDate()
Deprecated.Retrieves aDate
object for thisTime
object.String
toDateString()
Deprecated.Converts thisTime
value to a dateString
using the date formatter 'yyyy.MM.dd'.String
toDateString(Calendar calendar)
Deprecated.Converts thisTime
value to a dateString
using the formatter 'yyyy.MM.dd'.String
toRfc1123TimestampString()
Deprecated.Returns this time stamp in RFC1123 string format.String
toString()
Deprecated.Converts thisTime
value to aString
suitable for use in a file system name.String
toString(String format)
Deprecated.Converts thisTime
value to aString
using the given format.String
toString(Calendar calendar, String format)
Deprecated.Converts thisTime
object to aString
using the givenCalendar
and format.String
toTimeString()
Deprecated.Converts thisTime
to a timeString
using the formatter 'h.mma'.String
toTimeString(Calendar calendar)
Deprecated.Converts thisTime
to aDate String
using theDate
formatter 'h.mma'.static Time
valueOf(String string)
Deprecated.Retrieves aTime
instance by parsing 'yyyy.MM.dd-h.mma' format.static Time
valueOf(String string, String pattern)
Deprecated.Retrieves aTime
instance by parsing 'pattern' format.static Time
valueOf(Calendar calendar, String string)
Deprecated.Retrieves aTime
instance by parsing 'yyyy.MM.dd-h.mma' format.static Time
valueOf(Calendar calendar, TimeOfDay timeOfDay)
Deprecated.static Time
valueOf(Date date)
Deprecated.Retrieves aTime
instance based on the givenDate
object.static Time
valueOf(TimeOfDay timeOfDay)
Deprecated.Retrieves aTime
instance based on the givenTimeOfDay
object.-
Methods inherited from class org.apache.wicket.util.value.LongValue
compareTo, equals, greaterThan, greaterThan, greaterThanOrEqual, greaterThanOrEqual, hashCode, lessThan, lessThan, lessThanOrEqual, lessThanOrEqual, max, maxNullSafe, min
-
-
-
-
Field Detail
-
START_OF_UNIX_TIME
public static final Time START_OF_UNIX_TIME
Deprecated.the beginning of UNIX time: January 1, 1970, 0:00 GMT.
-
-
Method Detail
-
now
public static Time now()
Deprecated.Retrieves aTime
instance based on the current time.- Returns:
- the current
Time
-
millis
public static Time millis(long time)
Deprecated.Retrieves aTime
instance based on the given milliseconds.- Parameters:
time
- theTime
value in milliseconds since START_OF_UNIX_TIME- Returns:
- a corresponding immutable
Time
object
-
parseDate
public static Time parseDate(Calendar calendar, String string) throws ParseException
Deprecated.Retrieves aTime
instance by parsing 'yyyy.MM.dd' format.- Parameters:
calendar
- theCalendar
to use when parsing dateString
string
- theString
to parse- Returns:
- the time
- Throws:
ParseException
-
parseDate
public static Time parseDate(String string) throws ParseException
Deprecated.Retrieves aTime
instance by parsing 'yyyy.MM.dd' format using a local timeCalendar
.- Parameters:
string
- theString
to parse- Returns:
- the time
- Throws:
ParseException
-
valueOf
public static Time valueOf(Calendar calendar, String string) throws ParseException
Deprecated.Retrieves aTime
instance by parsing 'yyyy.MM.dd-h.mma' format.- Parameters:
calendar
- theCalendar
to use when parsing theString
string
- theString
to parse- Returns:
- an immutable UNIX
Time
value - Throws:
ParseException
-
valueOf
public static Time valueOf(Calendar calendar, TimeOfDay timeOfDay)
Deprecated.- Parameters:
calendar
- theCalendar
to usetimeOfDay
- the time of day- Returns:
- a
Time
value for the time of day today
-
valueOf
public static Time valueOf(Date date)
Deprecated.Retrieves aTime
instance based on the givenDate
object.- Parameters:
date
- ajava.util.Date
object- Returns:
- a corresponding immutable
Time
object
-
valueOf
public static Time valueOf(String string) throws ParseException
Deprecated.Retrieves aTime
instance by parsing 'yyyy.MM.dd-h.mma' format.- Parameters:
string
- theString
to parse- Returns:
- the
Time
instance - Throws:
ParseException
-
valueOf
public static Time valueOf(String string, String pattern) throws ParseException
Deprecated.Retrieves aTime
instance by parsing 'pattern' format.- Parameters:
string
- inputpattern
- the pattern to parse- Returns:
- a
Time
instance that resulted from parsing the givenString
- Throws:
ParseException
-
valueOf
public static Time valueOf(TimeOfDay timeOfDay)
Deprecated.Retrieves aTime
instance based on the givenTimeOfDay
object.- Parameters:
timeOfDay
- the time of day in local time- Returns:
- a
Time
value for the time of day today
-
add
public Time add(Duration duration)
Deprecated.Adds the givenDuration
to thisTime
object, moving the time into the future.- Parameters:
duration
- theDuration
to add- Returns:
- this
Time
+Duration
-
elapsedSince
public Duration elapsedSince()
Deprecated.Calculates the amount of time that has elapsed since thisTime
value.- Returns:
- the amount of time that has elapsed since this
Time
value - Throws:
IllegalStateException
- thrown if thisTime
value is in the future
-
fromNow
public Duration fromNow()
Deprecated.Retrieves theDuration
from now to thisTime
value. If thisTime
value is in the past, then theDuration
returned will be negative. Otherwise, it will be the number of milliseconds from now to thisTime
.- Returns:
- the
Duration
from now to thisTime
value
-
get
public int get(Calendar calendar, int field)
Deprecated.Retrieves the value of a field from the givenCalendar
.- Parameters:
calendar
- theCalendar
to usefield
- theCalendar
field to get- Returns:
- the field's value for this point in time on the given
Calendar
-
get
public int get(int field)
Deprecated.Retrieves the value of a field.- Parameters:
field
- theCalendar
field to get- Returns:
- the field's value (in local time)
-
getDayOfMonth
public int getDayOfMonth()
Deprecated.Retrieves the day of month field of the currentCalendar
.- Returns:
- the day of month field value
-
getDayOfMonth
public int getDayOfMonth(Calendar calendar)
Deprecated.Retrieves the day of month field of the givenCalendar
.- Parameters:
calendar
- theCalendar
to get the field value from- Returns:
- the day of month field value
-
getHour
public int getHour()
Deprecated.Retrieves the hour field of the currentCalendar
.- Returns:
- the hour field value
-
getHour
public int getHour(Calendar calendar)
Deprecated.Retrieves the hour field of the givenCalendar
.- Parameters:
calendar
- theCalendar
to get the field value from- Returns:
- the hour field value
-
getMinute
public int getMinute()
Deprecated.Retrieves the minute field of the currentCalendar
.- Returns:
- the minute field value
-
getMinute
public int getMinute(Calendar calendar)
Deprecated.Retrieves the minute field of the givenCalendar
.- Parameters:
calendar
- theCalendar
from which to get the field value- Returns:
- the minute field value
-
getMonth
public int getMonth()
Deprecated.Retrieves the month field of the currentCalendar
.- Returns:
- the month field value
-
getMonth
public int getMonth(Calendar calendar)
Deprecated.Retrieves the month field of the givenCalendar
.- Parameters:
calendar
- theCalendar
from which to get the field value- Returns:
- the month field value
-
getSecond
public int getSecond()
Deprecated.Retrieves the seconds field of the currentCalendar
.- Returns:
- the seconds field value
-
getSecond
public int getSecond(Calendar calendar)
Deprecated.Retrieves the seconds field of the givenCalendar
.- Parameters:
calendar
- theCalendar
from which to get the field value- Returns:
- the seconds field value
-
getYear
public int getYear()
Deprecated.Retrieves the year field of the currentCalendar
.- Returns:
- the year field value
-
getYear
public int getYear(Calendar calendar)
Deprecated.Retrieves the year field of the givenCalendar
.- Parameters:
calendar
- theCalendar
from which to get the field value- Returns:
- the year field value
-
subtract
public Time subtract(Duration duration)
Deprecated.Subtracts the givenDuration
from thisTime
object, moving the time into the past.- Parameters:
duration
- theDuration
to subtract- Returns:
- this duration of time
-
subtract
public Duration subtract(Time that)
Deprecated.Subtract time from this and returns the difference as aDuration
object.- Parameters:
that
- the time to subtract- Returns:
- the
Duration
between this and that time
-
toDate
public Date toDate()
Deprecated.Retrieves aDate
object for thisTime
object. A newDate
object is always returned rather than attempting to cache a date sinceDate
is mutable.- Returns:
- this immutable
Time
object as a mutablejava.util.Date
object
-
toDateString
public String toDateString()
Deprecated.Converts thisTime
value to a dateString
using the date formatter 'yyyy.MM.dd'.- Returns:
- the date string
-
toDateString
public String toDateString(Calendar calendar)
Deprecated.Converts thisTime
value to a dateString
using the formatter 'yyyy.MM.dd'.- Parameters:
calendar
- theCalendar
to use in the conversion- Returns:
- the date
String
-
toString
public String toString()
Deprecated.Converts thisTime
value to aString
suitable for use in a file system name.- Returns:
- this
Time
value as a formattedString
-
toString
public String toString(Calendar calendar, String format)
Deprecated.Converts thisTime
object to aString
using the givenCalendar
and format.- Parameters:
calendar
- theCalendar
to use in the conversionformat
- the format to use- Returns:
- this
Time
value as a formattedString
-
toString
public String toString(String format)
Deprecated.Converts thisTime
value to aString
using the given format.- Parameters:
format
- the format to use- Returns:
- this
Time
value as a formatted string
-
toRfc1123TimestampString
public String toRfc1123TimestampString()
Deprecated.Returns this time stamp in RFC1123 string format. Contrary toSimpleDateFormat
this is thread-safe. Taken from the source code of jetty 7.3.0, credits + thanks to Greg Wilkins!- Returns:
- timestamp string in RFC1123 format
-
after
public final boolean after(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrue
if thisTime
value is after the givenTime
argument's value.- Parameters:
that
- theAbstractTimeValue
to compare with- Returns:
true
if thisTime
value is afterthat
Time
value
-
before
public final boolean before(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrue
if thisTime
value is before the givenTime
argument's value.- Parameters:
that
- theAbstractTimeValue
to compare with- Returns:
true
if thisTime
value is beforethat
Time
value
-
toTimeString
public final String toTimeString()
Deprecated.Converts thisTime
to a timeString
using the formatter 'h.mma'.- Returns:
- the
Time
String
-
toTimeString
public final String toTimeString(Calendar calendar)
Deprecated.Converts thisTime
to aDate String
using theDate
formatter 'h.mma'.- Parameters:
calendar
- theCalendar
to use in the conversion- Returns:
- the
Date
String
-
getMilliseconds
public final long getMilliseconds()
Deprecated.Retrieves the number of milliseconds in thisTime
value.- Returns:
- the number of milliseconds in this
Time
value
-
-