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

## org.crosswire.common.icu
Class DateFormatter

    java.lang.Object
      org.crosswire.common.icu.DateFormatter

    public final class DateFormatter

extends Object

DateFormat provides a wrapper of some of DateFormat and SimpleDateFormat using ICU4J if present, otherwise from core Java. Note, only those methods in DateFormat that are actually used are here.

Author:
  DM Smith
See Also:
  `The GNU Lesser General Public License for details.
  The copyright to this program is held by its authors.`

Field Summary
`static int` | `DEFAULT` Constant for default style pattern.
`private static String` | `DEFAULT_DATE_FORMAT_CLASS`
`private static String` | `DEFAULT_SIMPLE_DATE_FORMAT_CLASS`
`private static Class<?>` | `defaultDateFormat`
`private static Class<?>` | `defaultSimpleDateFormat`
`private Object` | `formatter` The actual formatter.
`private Class<?>` | `formatterClass` The class of the formatter
`static int` | `FULL` Constant for full style pattern.
`private static org.slf4j.Logger` | `LOGGER`
`static int` | `LONG` Constant for long style pattern.
`static int` | `MEDIUM` Constant for medium style pattern.
`static int` | `SHORT` Constant for short style pattern.

Constructor Summary
`private` | `DateFormatter()` Prevent instantiation.

Method Summary
`String` | `format(Date date)` Formats a Date into a date/time string.
`static DateFormatter` | `getDateInstance()` Construct a DateFormatter with the default date format.
`static DateFormatter` | `getDateInstance(int format)` Construct a DateFormatter with the given date format.
`static DateFormatter` | `getSimpleDateInstance(String format)` Construct a simple DateFormatter with the given date format.
`Date` | `parse(String text)` Convert text to a date.
`void` | `setLenient(boolean lenient)` Set whether this DataFormatter should be lenient in parsing dates.

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

Field Detail

### FULL

    public static final int FULL

  Constant for full style pattern.

  See Also:
    Constant Field Values

### LONG

    public static final int LONG

  Constant for long style pattern.

  See Also:
    Constant Field Values

### MEDIUM

    public static final int MEDIUM

  Constant for medium style pattern.

  See Also:
    Constant Field Values

### SHORT

    public static final int SHORT

  Constant for short style pattern.

  See Also:
    Constant Field Values

### DEFAULT

    public static final int DEFAULT

  Constant for default style pattern. Its value is MEDIUM.

  See Also:
    Constant Field Values

### LOGGER

    private static final org.slf4j.Logger LOGGER

### DEFAULT_SIMPLE_DATE_FORMAT_CLASS

    private static final String DEFAULT_SIMPLE_DATE_FORMAT_CLASS

See Also:
  Constant Field Values

### DEFAULT_DATE_FORMAT_CLASS

    private static final String DEFAULT_DATE_FORMAT_CLASS

See Also:
  Constant Field Values

### formatter

    private Object formatter

  The actual formatter.

### formatterClass

    private Class<?> formatterClass

  The class of the formatter

### defaultSimpleDateFormat

    private static Class<?> defaultSimpleDateFormat

### defaultDateFormat

    private static Class<?> defaultDateFormat

Constructor Detail

### DateFormatter

    private DateFormatter()

  Prevent instantiation.

Method Detail

### getDateInstance

    public static DateFormatter getDateInstance(int format)

  Construct a DateFormatter with the given date format.

  Parameters:
    `format` - the date format
  Returns:
    a DateFormatter of the given format
  See Also:
    `DateFormat.getDateInstance(int)`

### getDateInstance

    public static DateFormatter getDateInstance()

  Construct a DateFormatter with the default date format.

  Returns:
    a DateFormatter of the default format
  See Also:
    `DateFormat.getDateInstance()`

### getSimpleDateInstance

    public static DateFormatter getSimpleDateInstance(String format)

  Construct a simple DateFormatter with the given date format.

  Parameters:
    `format` - the date format
  Returns:
    a DateFormatter with the given date format
  See Also:
    `DateFormat.getDateInstance(int)`

### setLenient

    public void setLenient(boolean lenient)

  Set whether this DataFormatter should be lenient in parsing dates.

  Parameters:
    `lenient` - whether to be lenient or not
  See Also:
    `DateFormat.setLenient(boolean)`

### format

    public String format(Date date)

  Formats a Date into a date/time string.

  Parameters:
    `date` - the time value to be formatted into a time string.
  Returns:
    the formatted time string.
  See Also:
    `DateFormat.format(java.util.Date)`

### parse

    public Date parse(String text)

  Convert text to a date.

  Parameters:
    `text` - the input to parse as a date
  Returns:
    the resultant date
  See Also:
    `DateFormat.parse(java.lang.String)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2015
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD