Class 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. Use Instant instead
    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.
    Since:
    1.2.6
    Author:
    Jonathan Locke
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static TimeZone GMT
      Deprecated.
      time zone for greenwich mean time
      static Time START_OF_UNIX_TIME
      Deprecated.
      the beginning of UNIX time: January 1, 1970, 0:00 GMT.
      • Fields inherited from class org.apache.wicket.util.value.LongValue

        value
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      Time add​(Duration duration)
      Deprecated.
      Adds the given Duration to this Time object, moving the time into the future.
      boolean after​(org.apache.wicket.util.time.AbstractTimeValue that)
      Deprecated.
      Returns true if this Time value is after the given Time argument's value.
      boolean before​(org.apache.wicket.util.time.AbstractTimeValue that)
      Deprecated.
      Returns true if this Time value is before the given Time argument's value.
      Duration elapsedSince()
      Deprecated.
      Calculates the amount of time that has elapsed since this Time value.
      Duration fromNow()
      Deprecated.
      Retrieves the Duration from now to this Time 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 given Calendar.
      int getDayOfMonth()
      Deprecated.
      Retrieves the day of month field of the current Calendar.
      int getDayOfMonth​(Calendar calendar)
      Deprecated.
      Retrieves the day of month field of the given Calendar.
      int getHour()
      Deprecated.
      Retrieves the hour field of the current Calendar.
      int getHour​(Calendar calendar)
      Deprecated.
      Retrieves the hour field of the given Calendar.
      long getMilliseconds()
      Deprecated.
      Retrieves the number of milliseconds in this Time value.
      int getMinute()
      Deprecated.
      Retrieves the minute field of the current Calendar.
      int getMinute​(Calendar calendar)
      Deprecated.
      Retrieves the minute field of the given Calendar.
      int getMonth()
      Deprecated.
      Retrieves the month field of the current Calendar.
      int getMonth​(Calendar calendar)
      Deprecated.
      Retrieves the month field of the given Calendar.
      int getSecond()
      Deprecated.
      Retrieves the seconds field of the current Calendar.
      int getSecond​(Calendar calendar)
      Deprecated.
      Retrieves the seconds field of the given Calendar.
      int getYear()
      Deprecated.
      Retrieves the year field of the current Calendar.
      int getYear​(Calendar calendar)
      Deprecated.
      Retrieves the year field of the given Calendar.
      static Time millis​(long time)
      Deprecated.
      Retrieves a Time instance based on the given milliseconds.
      static Time now()
      Deprecated.
      Retrieves a Time instance based on the current time.
      static Time parseDate​(String string)
      Deprecated.
      Retrieves a Time instance by parsing 'yyyy.MM.dd' format using a local time Calendar.
      static Time parseDate​(Calendar calendar, String string)
      Deprecated.
      Retrieves a Time instance by parsing 'yyyy.MM.dd' format.
      Time subtract​(Duration duration)
      Deprecated.
      Subtracts the given Duration from this Time object, moving the time into the past.
      Duration subtract​(Time that)
      Deprecated.
      Subtract time from this and returns the difference as a Duration object.
      Date toDate()
      Deprecated.
      Retrieves a Date object for this Time object.
      String toDateString()
      Deprecated.
      Converts this Time value to a date String using the date formatter 'yyyy.MM.dd'.
      String toDateString​(Calendar calendar)
      Deprecated.
      Converts this Time value to a date String using the formatter 'yyyy.MM.dd'.
      String toRfc1123TimestampString()
      Deprecated.
      Returns this time stamp in RFC1123 string format.
      String toString()
      Deprecated.
      Converts this Time value to a String suitable for use in a file system name.
      String toString​(String format)
      Deprecated.
      Converts this Time value to a String using the given format.
      String toString​(Calendar calendar, String format)
      Deprecated.
      Converts this Time object to a String using the given Calendar and format.
      String toTimeString()
      Deprecated.
      Converts this Time to a time String using the formatter 'h.mma'.
      String toTimeString​(Calendar calendar)
      Deprecated.
      Converts this Time to a Date String using the Date formatter 'h.mma'.
      static Time valueOf​(String string)
      Deprecated.
      Retrieves a Time instance by parsing 'yyyy.MM.dd-h.mma' format.
      static Time valueOf​(String string, String pattern)
      Deprecated.
      Retrieves a Time instance by parsing 'pattern' format.
      static Time valueOf​(Calendar calendar, String string)
      Deprecated.
      Retrieves a Time instance by parsing 'yyyy.MM.dd-h.mma' format.
      static Time valueOf​(Calendar calendar, TimeOfDay timeOfDay)
      Deprecated.
      Retrieves a Time instance based on the given Calendar and TimeOfDay objects.
      static Time valueOf​(Date date)
      Deprecated.
      Retrieves a Time instance based on the given Date object.
      static Time valueOf​(TimeOfDay timeOfDay)
      Deprecated.
      Retrieves a Time instance based on the given TimeOfDay object.
    • 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.
      • GMT

        public static final TimeZone GMT
        Deprecated.
        time zone for greenwich mean time
    • Method Detail

      • now

        public static Time now()
        Deprecated.
        Retrieves a Time instance based on the current time.
        Returns:
        the current Time
      • millis

        public static Time millis​(long time)
        Deprecated.
        Retrieves a Time instance based on the given milliseconds.
        Parameters:
        time - the Time 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 a Time instance by parsing 'yyyy.MM.dd' format.
        Parameters:
        calendar - the Calendar to use when parsing date String
        string - the String to parse
        Returns:
        the time
        Throws:
        ParseException
      • parseDate

        public static Time parseDate​(String string)
                              throws ParseException
        Deprecated.
        Retrieves a Time instance by parsing 'yyyy.MM.dd' format using a local time Calendar.
        Parameters:
        string - the String to parse
        Returns:
        the time
        Throws:
        ParseException
      • valueOf

        public static Time valueOf​(Calendar calendar,
                                   String string)
                            throws ParseException
        Deprecated.
        Retrieves a Time instance by parsing 'yyyy.MM.dd-h.mma' format.
        Parameters:
        calendar - the Calendar to use when parsing the String
        string - the String to parse
        Returns:
        an immutable UNIX Time value
        Throws:
        ParseException
      • valueOf

        public static Time valueOf​(Calendar calendar,
                                   TimeOfDay timeOfDay)
        Deprecated.
        Retrieves a Time instance based on the given Calendar and TimeOfDay objects.
        Parameters:
        calendar - the Calendar to use
        timeOfDay - the time of day
        Returns:
        a Time value for the time of day today
      • valueOf

        public static Time valueOf​(Date date)
        Deprecated.
        Retrieves a Time instance based on the given Date object.
        Parameters:
        date - a java.util.Date object
        Returns:
        a corresponding immutable Time object
      • valueOf

        public static Time valueOf​(String string)
                            throws ParseException
        Deprecated.
        Retrieves a Time instance by parsing 'yyyy.MM.dd-h.mma' format.
        Parameters:
        string - the String to parse
        Returns:
        the Time instance
        Throws:
        ParseException
      • valueOf

        public static Time valueOf​(String string,
                                   String pattern)
                            throws ParseException
        Deprecated.
        Retrieves a Time instance by parsing 'pattern' format.
        Parameters:
        string - input
        pattern - the pattern to parse
        Returns:
        a Time instance that resulted from parsing the given String
        Throws:
        ParseException
      • valueOf

        public static Time valueOf​(TimeOfDay timeOfDay)
        Deprecated.
        Retrieves a Time instance based on the given TimeOfDay 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 given Duration to this Time object, moving the time into the future.
        Parameters:
        duration - the Duration to add
        Returns:
        this Time + Duration
      • elapsedSince

        public Duration elapsedSince()
        Deprecated.
        Calculates the amount of time that has elapsed since this Time value.
        Returns:
        the amount of time that has elapsed since this Time value
        Throws:
        IllegalStateException - thrown if this Time value is in the future
      • fromNow

        public Duration fromNow()
        Deprecated.
        Retrieves the 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 .
        Returns:
        the Duration from now to this Time value
      • get

        public int get​(Calendar calendar,
                       int field)
        Deprecated.
        Retrieves the value of a field from the given Calendar.
        Parameters:
        calendar - the Calendar to use
        field - the Calendar 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 - the Calendar field to get
        Returns:
        the field's value (in local time)
      • getDayOfMonth

        public int getDayOfMonth()
        Deprecated.
        Retrieves the day of month field of the current Calendar.
        Returns:
        the day of month field value
      • getDayOfMonth

        public int getDayOfMonth​(Calendar calendar)
        Deprecated.
        Retrieves the day of month field of the given Calendar.
        Parameters:
        calendar - the Calendar to get the field value from
        Returns:
        the day of month field value
      • getHour

        public int getHour()
        Deprecated.
        Retrieves the hour field of the current Calendar.
        Returns:
        the hour field value
      • getHour

        public int getHour​(Calendar calendar)
        Deprecated.
        Retrieves the hour field of the given Calendar.
        Parameters:
        calendar - the Calendar to get the field value from
        Returns:
        the hour field value
      • getMinute

        public int getMinute()
        Deprecated.
        Retrieves the minute field of the current Calendar.
        Returns:
        the minute field value
      • getMinute

        public int getMinute​(Calendar calendar)
        Deprecated.
        Retrieves the minute field of the given Calendar.
        Parameters:
        calendar - the Calendar from which to get the field value
        Returns:
        the minute field value
      • getMonth

        public int getMonth()
        Deprecated.
        Retrieves the month field of the current Calendar.
        Returns:
        the month field value
      • getMonth

        public int getMonth​(Calendar calendar)
        Deprecated.
        Retrieves the month field of the given Calendar.
        Parameters:
        calendar - the Calendar from which to get the field value
        Returns:
        the month field value
      • getSecond

        public int getSecond()
        Deprecated.
        Retrieves the seconds field of the current Calendar.
        Returns:
        the seconds field value
      • getSecond

        public int getSecond​(Calendar calendar)
        Deprecated.
        Retrieves the seconds field of the given Calendar.
        Parameters:
        calendar - the Calendar from which to get the field value
        Returns:
        the seconds field value
      • getYear

        public int getYear()
        Deprecated.
        Retrieves the year field of the current Calendar.
        Returns:
        the year field value
      • getYear

        public int getYear​(Calendar calendar)
        Deprecated.
        Retrieves the year field of the given Calendar.
        Parameters:
        calendar - the Calendar from which to get the field value
        Returns:
        the year field value
      • subtract

        public Time subtract​(Duration duration)
        Deprecated.
        Subtracts the given Duration from this Time object, moving the time into the past.
        Parameters:
        duration - the Duration to subtract
        Returns:
        this duration of time
      • subtract

        public Duration subtract​(Time that)
        Deprecated.
        Subtract time from this and returns the difference as a Duration object.
        Parameters:
        that - the time to subtract
        Returns:
        the Duration between this and that time
      • toDate

        public Date toDate()
        Deprecated.
        Retrieves a Date object for this Time object. A new Date object is always returned rather than attempting to cache a date since Date is mutable.
        Returns:
        this immutable Time object as a mutable java.util.Date object
      • toDateString

        public String toDateString()
        Deprecated.
        Converts this Time value to a date String using the date formatter 'yyyy.MM.dd'.
        Returns:
        the date string
      • toDateString

        public String toDateString​(Calendar calendar)
        Deprecated.
        Converts this Time value to a date String using the formatter 'yyyy.MM.dd'.
        Parameters:
        calendar - the Calendar to use in the conversion
        Returns:
        the date String
      • toString

        public String toString()
        Deprecated.
        Converts this Time value to a String suitable for use in a file system name.
        Returns:
        this Time value as a formatted String
      • toString

        public String toString​(Calendar calendar,
                               String format)
        Deprecated.
        Converts this Time object to a String using the given Calendar and format.
        Parameters:
        calendar - the Calendar to use in the conversion
        format - the format to use
        Returns:
        this Time value as a formatted String
      • toString

        public String toString​(String format)
        Deprecated.
        Converts this Time value to a String 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 to SimpleDateFormat 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.
        Returns true if this Time value is after the given Time argument's value.
        Parameters:
        that - the AbstractTimeValue to compare with
        Returns:
        true if this Time value is after that Time value
      • before

        public final boolean before​(org.apache.wicket.util.time.AbstractTimeValue that)
        Deprecated.
        Returns true if this Time value is before the given Time argument's value.
        Parameters:
        that - the AbstractTimeValue to compare with
        Returns:
        true if this Time value is before that Time value
      • toTimeString

        public final String toTimeString()
        Deprecated.
        Converts this Time to a time String using the formatter 'h.mma'.
        Returns:
        the Time String
      • toTimeString

        public final String toTimeString​(Calendar calendar)
        Deprecated.
        Converts this Time to a Date String using the Date formatter 'h.mma'.
        Parameters:
        calendar - the Calendar to use in the conversion
        Returns:
        the Date String
      • getMilliseconds

        public final long getMilliseconds()
        Deprecated.
        Retrieves the number of milliseconds in this Time value.
        Returns:
        the number of milliseconds in this Time value