bb.util
Class DateUtil.IsoDateFormat
java.lang.Object
java.text.Format
java.text.DateFormat
java.text.SimpleDateFormat
bb.util.DateUtil.IsoDateFormat
- All Implemented Interfaces:
- Serializable, Cloneable
- Enclosing class:
- DateUtil
private static class DateUtil.IsoDateFormat
- extends SimpleDateFormat
Formats/parses dates that are ISO 8601 compliant.
An ISO 8601 year date must start with a -/+ char to denote the BC/AD era.
Next comes at least 4 digits (zero padded if necessary) that specify the year.
For the special case of an AD era year that has exactly 4 digits,
the ISO 8601 spec allows the + era prefix to be dropped, as it may then be implicitly understood;
this class follows that option, to conform with how people usually write dates.
It will correctly parse any ISO 8601 compliant String,
even ones that do not follow the above option (i.e. always start with a - or + era char).
Fields inherited from class java.text.DateFormat |
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 |
Methods inherited from class java.text.SimpleDateFormat |
applyLocalizedPattern, applyPattern, clone, equals, formatToCharacterIterator, get2DigitYearStart, getDateFormatSymbols, hashCode, parse, set2DigitYearStart, setDateFormatSymbols, toLocalizedPattern, toPattern |
Methods inherited from class java.text.DateFormat |
format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, isLenient, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
DateUtil.IsoDateFormat
private DateUtil.IsoDateFormat(String pattern)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
format
public StringBuffer format(Date date,
StringBuffer sb,
FieldPosition pos)
- Overrides:
format
in class SimpleDateFormat
parse
public Date parse(String s)
throws ParseException
- Overrides:
parse
in class DateFormat
- Throws:
ParseException