public final class DateFormatUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DateFormatUtil.ThreadLocalDateFormat |
Modifier and Type | Field and Description |
---|---|
static Locale |
CANONICAL_LOCALE
Fixed Locale needed for parsing/formatting Milliseconds in the
canonical representation.
|
static TimeZone |
CANONICAL_TZ
Fixed TimeZone (UTC) needed for parsing/formatting Dates in the
canonical representation.
|
static DateFormatUtil.ThreadLocalDateFormat |
FORMAT_THREAD_LOCAL
Thread safe DateFormat that can format in the canonical
ISO8601 date format, not including the trailing "Z" (since it is
left off in the internal indexed values)
|
static String |
NOW |
static TimeZone |
UTC |
static char |
Z |
Modifier and Type | Method and Description |
---|---|
static String |
formatDate(Date d)
Return the standard human readable form of the date
|
static String |
formatExternal(Date d)
Return the standard human readable form of the date (with trailing 'Z')
|
static Date |
parseDate(String s)
Thread safe method that can be used to parse a Date
without the trailing 'Z'
|
static Date |
parseDateLenient(String s,
SolrQueryRequest req)
Parse a date string in the standard format, or any supported by DateUtil.parseDate
|
static Date |
parseMath(Date now,
String val)
Parses a String which may be a date (in the standard format)
followed by an optional math expression.
|
static Date |
parseMathLenient(Date now,
String val,
SolrQueryRequest req)
Parses a String which may be a date
followed by an optional math expression.
|
public static final TimeZone UTC
public static final TimeZone CANONICAL_TZ
public static final Locale CANONICAL_LOCALE
public static final String NOW
public static final char Z
public static final DateFormatUtil.ThreadLocalDateFormat FORMAT_THREAD_LOCAL
public static Date parseMath(Date now, String val)
now
- an optional fixed date to use as "NOW" in the DateMathParserval
- the string to parsepublic static String formatExternal(Date d)
public static String formatDate(Date d)
public static Date parseDate(String s) throws ParseException
ParseException
public static Date parseDateLenient(String s, SolrQueryRequest req) throws ParseException
ParseException
public static Date parseMathLenient(Date now, String val, SolrQueryRequest req)
now
- an optional fixed date to use as "NOW" in the DateMathParserval
- the string to parseCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.