org.restlet.engine.util

## Class DateUtils

- java.lang.Object
- - org.restlet.engine.util.DateUtils

    public final class DateUtils
    extends java.lang.Object

Date manipulation utilities.

Author:
  Jerome Louvel

### Field Summary

Fields
`static java.util.List<java.lang.String>` `FORMAT_ASC_TIME` Obsoleted HTTP date format (ANSI C asctime() format).
`static java.util.List<java.lang.String>` `FORMAT_RFC_1036` Obsoleted HTTP date format (RFC 1036).
`static java.util.List<java.lang.String>` `FORMAT_RFC_1123` Preferred HTTP date format (RFC 1123).
`static java.util.List<java.lang.String>` `FORMAT_RFC_3339` W3C date format (RFC 3339).
`static java.util.List<java.lang.String>` `FORMAT_RFC_822` Common date format (RFC 822).

### Method Summary

Methods
`static boolean` `after(java.util.Date baseDate, java.util.Date afterDate)` Compares two date with a precision of one second.
`static boolean` `before(java.util.Date baseDate, java.util.Date beforeDate)` Compares two date with a precision of one second.
`static boolean` `equals(java.util.Date baseDate, java.util.Date otherDate)` Compares two date with a precision of one second.
`static java.lang.String` `format(java.util.Date date)` Formats a Date in the default HTTP format (RFC 1123).
`static java.lang.String` `format(java.util.Date date, java.lang.String format)` Formats a Date according to the first format in the array.
`static java.util.Date` `parse(java.lang.String date)` Parses a formatted date into a Date object using the default HTTP format (RFC 1123).
`static java.util.Date` `parse(java.lang.String date, java.util.List<java.lang.String> formats)` Parses a formatted date into a Date object.
`static java.util.Date` `unmodifiable(java.util.Date date)` Returns an immutable version of a given date.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### FORMAT_ASC_TIME

    public static final java.util.List<java.lang.String> FORMAT_ASC_TIME

Obsoleted HTTP date format (ANSI C asctime() format).

#### FORMAT_RFC_1036

    public static final java.util.List<java.lang.String> FORMAT_RFC_1036

Obsoleted HTTP date format (RFC 1036).

#### FORMAT_RFC_1123

    public static final java.util.List<java.lang.String> FORMAT_RFC_1123

Preferred HTTP date format (RFC 1123).

#### FORMAT_RFC_3339

    public static final java.util.List<java.lang.String> FORMAT_RFC_3339

W3C date format (RFC 3339).

#### FORMAT_RFC_822

    public static final java.util.List<java.lang.String> FORMAT_RFC_822

Common date format (RFC 822).

### Method Detail

#### after

    public static boolean after(java.util.Date baseDate,
                java.util.Date afterDate)

Compares two date with a precision of one second.

Parameters:
  `baseDate` - The base date
  `afterDate` - The date supposed to be after.
Returns:
  True if the afterDate is indeed after the baseDate.

#### before

    public static boolean before(java.util.Date baseDate,
                 java.util.Date beforeDate)

Compares two date with a precision of one second.

Parameters:
  `baseDate` - The base date
  `beforeDate` - The date supposed to be before.
Returns:
  True if the beforeDate is indeed before the baseDate.

#### equals

    public static boolean equals(java.util.Date baseDate,
                 java.util.Date otherDate)

Compares two date with a precision of one second.

Parameters:
  `baseDate` - The base date
  `otherDate` - The other date supposed to be equals.
Returns:
  True if both dates are equals.

#### format

    public static java.lang.String format(java.util.Date date)

Formats a Date in the default HTTP format (RFC 1123).

Parameters:
  `date` - The date to format.
Returns:
  The formatted date.

#### format

    public static java.lang.String format(java.util.Date date,
                          java.lang.String format)

Formats a Date according to the first format in the array.

Parameters:
  `date` - The date to format.
  `format` - The date format to use.
Returns:
  The formatted date.

#### parse

    public static java.util.Date parse(java.lang.String date)

Parses a formatted date into a Date object using the default HTTP format (RFC 1123).

Parameters:
  `date` - The date to parse.
Returns:
  The parsed date.

#### parse

    public static java.util.Date parse(java.lang.String date,
                       java.util.List<java.lang.String> formats)

Parses a formatted date into a Date object.

Parameters:
  `date` - The date to parse.
  `formats` - The date formats to use sorted by completeness.
Returns:
  The parsed date.

#### unmodifiable

    public static java.util.Date unmodifiable(java.util.Date date)

Returns an immutable version of a given date.

Parameters:
  `date` - The modifiable date.
Returns:
  An immutable version of a given date.