public class CachingDateFormat extends SimpleDateFormat
The cached string-date mappings are stored in a WeakHashMap.
DateFormat.setLenient(boolean)
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
CachingDateFormat.SimpleDateFormatAndResolution |
static class |
CachingDateFormat.StringAndResolution |
DateFormat.Field
Modifier and Type | Field and Description |
---|---|
static String |
FORMAT_CMIS_SQL
yyyy-MM-dd'T'HH:mm:ss
|
static String |
FORMAT_DATE_GENERIC
yyyy-MM-dd
|
static String |
FORMAT_FULL_GENERIC
yyyy-MM-dd'T'HH:mm:ss
|
static String |
FORMAT_SOLR |
static String |
FORMAT_TIME_GENERIC
HH:mm:ss
|
static CachingDateFormat.StringAndResolution[] |
LENIENT_FORMATS |
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
Modifier and Type | Method and Description |
---|---|
static SimpleDateFormat |
getCmisSqlDatetimeFormat() |
static SimpleDateFormat |
getDateFormat() |
static SimpleDateFormat |
getDateFormat(int length,
Locale locale,
boolean lenient) |
static SimpleDateFormat |
getDateFormat(String pattern,
boolean lenient) |
static SimpleDateFormat |
getDateOnlyFormat() |
static SimpleDateFormat |
getDateTimeFormat(int dateLength,
int timeLength,
Locale locale,
boolean lenient) |
static CachingDateFormat.SimpleDateFormatAndResolution[] |
getLenientFormatters() |
static SimpleDateFormat |
getSolrDatetimeFormat() |
static SimpleDateFormat |
getTimeOnlyFormat() |
static Pair<Date,Integer> |
lenientParse(String text,
int minimumResolution) |
Date |
parse(String text,
ParsePosition pos)
Parses and caches date strings.
|
String |
toString() |
applyLocalizedPattern, applyPattern, clone, equals, format, formatToCharacterIterator, get2DigitYearStart, getDateFormatSymbols, hashCode, set2DigitYearStart, setDateFormatSymbols, toLocalizedPattern, toPattern
format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, isLenient, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone
format, parseObject
public static final String FORMAT_FULL_GENERIC
yyyy-MM-dd'T'HH:mm:ss
public static final String FORMAT_CMIS_SQL
yyyy-MM-dd'T'HH:mm:ss
public static final String FORMAT_SOLR
public static final CachingDateFormat.StringAndResolution[] LENIENT_FORMATS
public static final String FORMAT_DATE_GENERIC
yyyy-MM-dd
public static final String FORMAT_TIME_GENERIC
HH:mm:ss
public static SimpleDateFormat getDateFormat(int length, Locale locale, boolean lenient)
length
- the type of date format, e.g. DateFormat.LONG
locale
- the Locale
that will be used to determine the
date patterngetDateFormat(String, boolean)
,
DateFormat.SHORT
,
DateFormat.MEDIUM
,
DateFormat.LONG
,
DateFormat.FULL
public static SimpleDateFormat getDateTimeFormat(int dateLength, int timeLength, Locale locale, boolean lenient)
dateLength
- the type of date format, e.g. DateFormat.LONG
timeLength
- the type of time format, e.g. DateFormat.LONG
locale
- the Locale
that will be used to determine the
date patterngetDateFormat(String, boolean)
,
DateFormat.SHORT
,
DateFormat.MEDIUM
,
DateFormat.LONG
,
DateFormat.FULL
public static SimpleDateFormat getDateFormat(String pattern, boolean lenient)
pattern
- the conversion pattern to uselenient
- true to allow the parser to extract the date in conceivable
mannerpublic static SimpleDateFormat getDateFormat()
FORMAT_FULL_GENERIC
public static SimpleDateFormat getCmisSqlDatetimeFormat()
public static SimpleDateFormat getSolrDatetimeFormat()
public static SimpleDateFormat getDateOnlyFormat()
FORMAT_DATE_GENERIC
public static SimpleDateFormat getTimeOnlyFormat()
FORMAT_TIME_GENERIC
public Date parse(String text, ParsePosition pos)
parse
in class SimpleDateFormat
DateFormat.parse(java.lang.String,
java.text.ParsePosition)
public static Pair<Date,Integer> lenientParse(String text, int minimumResolution) throws ParseException
ParseException
public static CachingDateFormat.SimpleDateFormatAndResolution[] getLenientFormatters()
Copyright © 2005–2019 Alfresco Software. All rights reserved.