public class FastDateParser extends SimpleDateBasic implements PositionDateParser
FastDatePrinter
,
Serialized Formlocale, pattern, timeZone
Constructor and Description |
---|
FastDateParser(String pattern,
TimeZone timeZone,
Locale locale)
Constructs a new FastDateParser.
|
FastDateParser(String pattern,
TimeZone timeZone,
Locale locale,
Date centuryStart)
Constructs a new FastDateParser.
|
Modifier and Type | Method and Description |
---|---|
Date |
parse(CharSequence source)
将日期字符串解析并转换为
Date 对象 |
boolean |
parse(CharSequence source,
ParsePosition pos,
Calendar calendar)
|
equals, getLocale, getPattern, getTimeZone, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
parse, parseCalendar
getLocale, getPattern, getTimeZone
public 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(CharSequence source) throws DateException
DateParser
Date
对象parse
in interface DateParser
source
- 被解析的日期字符串Date
对象DateException
- 转换异常,被转换的字符串格式错误。public boolean parse(CharSequence source, ParsePosition pos, Calendar calendar)
PositionDateParser
parse
in interface PositionDateParser
source
- 被转换的日期字符串pos
- 定义开始转换的位置,转换结束后更新转换到的位置,null
表示忽略,从第一个字符开始转换calendar
- 解析并更新的Calendar
true
,否则返回false
Copyright © 2025. All rights reserved.