Interface PositionDateParser
- All Superinterfaces:
DateParser,DatePrinter
- All Known Implementing Classes:
FastDateParser,FormatBuilder
带有
ParsePosition的日期解析接口,用于解析日期字符串为 Date 对象- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
Modifier and TypeMethodDescriptionparse(String source, ParsePosition pos) 将日期字符串解析并转换为Date对象 等价于DateFormat.parse(String, ParsePosition)booleanparse(String source, ParsePosition pos, Calendar calendar) 根据给定格式更新CalendarUpon success, the ParsePosition index is updated to indicate how much of the source text was consumed.Methods inherited from interface org.miaixz.bus.core.center.date.format.parser.DateParser
parseMethods inherited from interface org.miaixz.bus.core.center.date.printer.DatePrinter
getLocale, getPattern, getTimeZone
-
Method Details
-
parse
将日期字符串解析并转换为Date对象 等价于DateFormat.parse(String, ParsePosition)- Parameters:
source- 日期字符串pos-ParsePosition- Returns:
Date
-
parse
根据给定格式更新CalendarUpon 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.- Parameters:
source- 被转换的日期字符串pos- 定义开始转换的位置,转换结束后更新转换到的位置calendar- The calendar into which to set parsed fields.- Returns:
- true, if source has been parsed (pos parsePosition is updated); otherwise false (and pos errorIndex is updated)
- Throws:
IllegalArgumentException- when Calendar has been set to be not lenient, and a parsed field is out of range.
-