: Class DateCache

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mortbay.Base
Class DateCache

    java.lang.Object
      |
      +--com.mortbay.Base.DateCache

public final class DateCache
extends java.lang.Object

DateCache. Computes String representations of Dates and caches the results so that subsequent requests within the same minute will be fast. Only format strings that contain either "ss" or "ss.SSS" are handled. If consecutive calls are frequently very different, then this may be a little slower than a normal DateFormat.

Version:
  1.0 Wed Mar 3 1999
Author:
  Kent Johnson

Constructor Summary
`DateCache()` Constructor.
`DateCache(java.lang.String format)` Constructor.
`DateCache(java.lang.String format, java.text.DateFormatSymbols s)`
`DateCache(java.lang.String format, java.util.Locale l)`

Method Summary
`java.lang.String` | `format(java.util.Date inDate)` Format a date according to our stored formatter.
`java.lang.String` | `format(long inDate)` Format a date according to our stored formatter.
`java.text.SimpleDateFormat` | `getFormat()`
`void` | `setTimeZone(java.util.TimeZone tz)` Set the timezone

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DateCache

    public DateCache()

  Constructor. Make a DateCache that will use a default format. The default format generates the same results as Date.toString().

### DateCache

    public DateCache(java.lang.String format)

  Constructor. Make a DateCache that will use the given format

### DateCache

    public DateCache(java.lang.String format,
                     java.util.Locale l)

### DateCache

    public DateCache(java.lang.String format,
                     java.text.DateFormatSymbols s)

Method Detail

### getFormat

    public java.text.SimpleDateFormat getFormat()

### format

    public java.lang.String format(java.util.Date inDate)

  Format a date according to our stored formatter.
  Parameters:
    `inDate` -
  Returns:
    Formatted date

### format

    public java.lang.String format(long inDate)

  Format a date according to our stored formatter.
  Parameters:
    `inDate` -
  Returns:
    Formatted date

### setTimeZone

    public void setTimeZone(java.util.TimeZone tz)

  Set the timezone
  Parameters:
    `tz` - TimeZone

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD