public class FastDateParser extends SimpleDateBasic implements PositionDateParser
FastDatePrinter,
序列化表格locale, pattern, timeZone| 构造器和说明 |
|---|
FastDateParser(String pattern,
TimeZone timeZone,
Locale locale)
Constructs a new FastDateParser.
|
FastDateParser(String pattern,
TimeZone timeZone,
Locale locale,
Date centuryStart)
Constructs a new FastDateParser.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Date |
parse(String source)
|
Date |
parse(String source,
ParsePosition pos)
|
boolean |
parse(String source,
ParsePosition pos,
Calendar calendar)
根据给定格式更新
Calendar
Upon success, the ParsePosition index is updated to indicate how much of the source text was consumed. |
equals, getLocale, getPattern, getTimeZone, hashCode, toStringgetLocale, getPattern, getTimeZonepublic FastDateParser(String pattern, TimeZone timeZone, Locale locale)
Constructs a new FastDateParser.
Use FastDateFormat.getInstance(String, TimeZone, Locale) or another variation of the factory methods of FastDateFormat to get a cached FastDateParser instance.
pattern - non-null SimpleDateFormat compatible patterntimeZone - non-null time zone to uselocale - non-null localepublic FastDateParser(String pattern, TimeZone timeZone, Locale locale, Date centuryStart)
Constructs a new FastDateParser.
pattern - non-null SimpleDateFormat compatible patterntimeZone - non-null time zone to uselocale - non-null localecenturyStart - The start of the century for 2 digit year parsingpublic Date parse(String source) throws DateException
DateParserparse 在接口中 DateParsersource - 被解析的日期字符串Date对象DateException - 转换异常,被转换的字符串格式错误。public Date parse(String source, ParsePosition pos)
PositionDateParserparse 在接口中 PositionDateParsersource - 日期字符串pos - ParsePositionDatepublic boolean parse(String source, ParsePosition pos, Calendar calendar)
PositionDateParserCalendar
Upon success, the ParsePosition index is updated to indicate how much of the source text was consumed.
Not all source text needs to be consumed.
Upon parse failure, ParsePosition error index is updated to the offset of the source text which does not match the supplied format.parse 在接口中 PositionDateParsersource - 被转换的日期字符串pos - 定义开始转换的位置,转换结束后更新转换到的位置calendar - The calendar into which to set parsed fields.Copyright © 2024. All rights reserved.