public class DateUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<java.text.DateFormat> |
iso8601InputFormats
So we can return Date objects for these, this is the
list (in preference order) of the various ISO-8601
variants that we try when processing a date based
property.
|
static java.util.TimeZone |
MIDDAY
Custom time zone used to interpret date values without a time
component in a way that most likely falls within the same day
regardless of in which time zone it is later interpreted.
|
static java.util.TimeZone |
UTC
The UTC time zone.
|
| Constructor and Description |
|---|
DateUtils() |
| Modifier and Type | Method and Description |
|---|---|
private static java.text.DateFormat |
createDateFormat(java.lang.String format,
java.util.TimeZone timezone) |
private static java.lang.String |
doFormatDate(java.util.Calendar calendar) |
static java.lang.String |
formatDate(java.util.Calendar date)
Returns a ISO 8601 representation of the given date.
|
static java.lang.String |
formatDate(java.util.Date date)
Returns a ISO 8601 representation of the given date.
|
static java.lang.String |
formatDateUnknownTimezone(java.util.Date date)
Returns a ISO 8601 representation of the given date, which is
in an unknown timezone.
|
private java.util.List<java.text.DateFormat> |
loadDateFormats() |
java.util.Date |
tryToParse(java.lang.String dateString)
Tries to parse the date string; returns null if no parse was possible.
|
public static final java.util.TimeZone UTC
TimeZone.getTimeZone(String)
understands "UTC" in all environments, but it'll fall back to GMT
in such cases, which is in practice equivalent to UTC.public static final java.util.TimeZone MIDDAY
private final java.util.List<java.text.DateFormat> iso8601InputFormats
private static java.text.DateFormat createDateFormat(java.lang.String format,
java.util.TimeZone timezone)
private java.util.List<java.text.DateFormat> loadDateFormats()
public static java.lang.String formatDate(java.util.Date date)
date - given datepublic static java.lang.String formatDate(java.util.Calendar date)
date - given datepublic static java.lang.String formatDateUnknownTimezone(java.util.Date date)
date - given dateprivate static java.lang.String doFormatDate(java.util.Calendar calendar)
public java.util.Date tryToParse(java.lang.String dateString)
DateUtils
for each class.dateString -