org.apache.mina.http

## Class DateUtil

- java.lang.Object
- - org.apache.mina.http.DateUtil

    public class DateUtil
    extends Object

Author:
  Apache MINA Project

### Constructor Summary

Constructors
Constructor and Description
`DateUtil()`

### Method Summary

Methods
`static String` `getCurrentAsString()` Returns the current date as String
`static String` `getDateAsString(Date date)` Convert a given `Date` object to a `RFC 1123` formatted `String`.
`static long` `parseToMilliseconds(String dateValue)` Parse a given date `String` to a `long` representation of the time.
`static String` `parseToRFC1123(long dateValue)` Converts a millisecond representation of a date to a `RFC 1123` formatted `String`.

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

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

### Constructor Detail

#### DateUtil

    public DateUtil()

### Method Detail

#### getCurrentAsString

    public static String getCurrentAsString()

Returns the current date as String

Returns:
  Current Date as String, in the format EEE, dd MMM yyyy HH:mm:ss zzz

#### parseToMilliseconds

    public static long parseToMilliseconds(String dateValue)

Parse a given date `String` to a `long` representation of the time. Where the provided value is all digits the value is returned as a `long`, otherwise attempt is made to parse the `String` as a RFC 1123 date.

Parameters:
  `dateValue` - the value to parse.
Returns:
  the `long` value following parse, or zero where not successful.

#### parseToRFC1123

    public static String parseToRFC1123(long dateValue)

Converts a millisecond representation of a date to a `RFC 1123` formatted `String`.

Parameters:
  `dateValue` - the `Date` represented as milliseconds.
Returns:
  a `String` representation of the date.

#### getDateAsString

    public static String getDateAsString(Date date)

Convert a given `Date` object to a `RFC 1123` formatted `String`.

Parameters:
  `date` - the `Date` object to convert
Returns:
  a `String` representation of the date.