public interface DateParser extends DateBasic
Date
对象Modifier and Type | Method and Description |
---|---|
Date |
parse(String source)
|
Date |
parse(String source,
ParsePosition pos)
|
boolean |
parse(String source,
ParsePosition pos,
Calendar calendar)
根据给定格式转换日期字符串
Updates the Calendar with parsed fields.
|
Object |
parseObject(String source)
将日期字符串解析并转换为
Date 对象 |
Object |
parseObject(String source,
ParsePosition pos)
|
getLocale, getPattern, getTimeZone
Date parse(String source) throws ParseException
source
- 日期字符串Date
ParseException
- 转换异常,被转换的字符串格式错误。Date parse(String source, ParsePosition pos)
source
- 日期字符串pos
- ParsePosition
Date
boolean parse(String source, ParsePosition pos, Calendar calendar)
source
- 被转换的日期字符串pos
- 定义开始转换的位置,转换结束后更新转换到的位置calendar
- The calendar into which to set parsed fields.IllegalArgumentException
- when Calendar has been set to be not lenient, and a parsed field is out of range.Object parseObject(String source) throws ParseException
Date
对象source
- A String
whose beginning should be parsed.java.util.Date
objectParseException
- if the beginning of the specified string cannot be parsed.Format.parseObject(String)
Object parseObject(String source, ParsePosition pos)
source
- A String
whose beginning should be parsed.pos
- the parse positionjava.util.Date
objectDateFormat.parseObject(String, ParsePosition)
Copyright © 2021. All rights reserved.