Class DateUtil
java.lang.Object
org.apache.mina.http.DateUtil
An utility class for Dates manipulations
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final PatternPattern to find digits only.private static final TimeZoneprivate static final Localeprivate static final DateFormatprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringgetDateAsString(Date date) Convert a givenDateobject to aRFC 1123formattedString.private static longparseDateStringToMilliseconds(String dateString) Translate a given dateStringin the RFC 1123 format to alongrepresenting the number of milliseconds since epoch.static longparseToMilliseconds(String dateValue) Parse a given dateStringto alongrepresentation of the time.static StringparseToRFC1123(long dateValue) Converts a millisecond representation of a date to aRFC 1123formattedString.
-
Field Details
-
LOCALE
-
GMT_ZONE
-
RFC_1123_PATTERN
- See Also:
-
RFC_1123_FORMAT
-
DIGIT_PATTERN
Pattern to find digits only.
-
-
Constructor Details
-
DateUtil
private DateUtil()
-
-
Method Details
-
getCurrentAsString
- Returns:
- The current date as a string
-
parseDateStringToMilliseconds
Translate a given dateStringin the RFC 1123 format to alongrepresenting the number of milliseconds since epoch.- Parameters:
dateString- a dateStringin the RFC 1123 format.- Returns:
- the parsed
Datein milliseconds.
-
parseToMilliseconds
Parse a given dateStringto alongrepresentation of the time. Where the provided value is all digits the value is returned as along, otherwise attempt is made to parse theStringas a RFC 1123 date.- Parameters:
dateValue- the value to parse.- Returns:
- the
longvalue following parse, or zero where not successful.
-
parseToRFC1123
Converts a millisecond representation of a date to aRFC 1123formattedString.- Parameters:
dateValue- theDaterepresented as milliseconds.- Returns:
- a
Stringrepresentation of the date.
-
getDateAsString
-