public final class DateUtils extends Object
Modifier and Type | Field and Description |
---|---|
static List<String> |
FORMAT_ASC_TIME
Obsoleted HTTP date format (ANSI C asctime() format).
|
static List<String> |
FORMAT_ISO_8601
AWS date format (ISO 8601).
|
static List<String> |
FORMAT_RFC_1036
Obsoleted HTTP date format (RFC 1036).
|
static List<String> |
FORMAT_RFC_1123
Preferred HTTP date format (RFC 1123).
|
static List<String> |
FORMAT_RFC_3339
W3C date format (RFC 3339).
|
static List<String> |
FORMAT_RFC_822
Common date format (RFC 822).
|
Modifier and Type | Method and Description |
---|---|
static boolean |
after(Date baseDate,
Date afterDate)
Compares two date with a precision of one second.
|
static boolean |
before(Date baseDate,
Date beforeDate)
Compares two date with a precision of one second.
|
static boolean |
equals(Date baseDate,
Date otherDate)
Compares two date with a precision of one second.
|
static String |
format(Date date)
Formats a Date in the default HTTP format (RFC 1123).
|
static String |
format(Date date,
List<String> formats)
Formats a Date according to the first format in the array.
|
static String |
format(Date date,
String format)
Formats a Date according to the given format.
|
static Date |
parse(String date)
Parses a formatted date into a Date object using the default HTTP format
(RFC 1123).
|
static Date |
parse(String date,
List<String> formats)
Parses a formatted date into a Date object.
|
static Date |
unmodifiable(Date date)
Returns an immutable version of a given date.
|
public static final List<String> FORMAT_ASC_TIME
public static final List<String> FORMAT_RFC_1036
public static final List<String> FORMAT_RFC_1123
public static final List<String> FORMAT_RFC_3339
public static final List<String> FORMAT_ISO_8601
public static boolean after(Date baseDate, Date afterDate)
baseDate
- The base dateafterDate
- The date supposed to be after.public static boolean before(Date baseDate, Date beforeDate)
baseDate
- The base datebeforeDate
- The date supposed to be before.public static boolean equals(Date baseDate, Date otherDate)
baseDate
- The base dateotherDate
- The other date supposed to be equals.public static String format(Date date)
date
- The date to format.public static String format(Date date, List<String> formats)
date
- The date to format.formats
- The array of date formats to use.public static String format(Date date, String format)
date
- The date to format.format
- The date format to use.public static Date parse(String date)
date
- The date to parse.public static Date parse(String date, List<String> formats)
date
- The date to parse.formats
- The date formats to use sorted by completeness.Copyright © 2005–2016. All rights reserved.