public interface DateParser
DateFormat
. You can obtain an object implementing this
interface by using one of the FastDateFormat factory methods.
Warning: Since binary compatible methods may be added to this interface in any release, developers are not expected to implement this interface.
Modifier and Type | Method and Description |
---|---|
Locale |
getLocale()
Gets the locale used by this parser.
|
String |
getPattern()
Gets the pattern used by this parser.
|
TimeZone |
getTimeZone()
Gets the time zone used by this parser.
|
Date |
parse(String source)
Equivalent to DateFormat.parse(String).
|
Date |
parse(String source,
ParsePosition pos)
Equivalent to DateFormat.parse(String, ParsePosition).
|
boolean |
parse(String source,
ParsePosition pos,
Calendar calendar)
Parses a formatted date string according to the format.
|
Object |
parseObject(String source)
Parses text from a string to produce a Date.
|
Object |
parseObject(String source,
ParsePosition pos)
Parses a date/time string according to the given parse position.
|
Date parse(String source) throws ParseException
DateFormat.parse(String)
for more information.source
- A String
whose beginning should be parsed.Date
parsed from the stringParseException
- if the beginning of the specified string cannot be parsed.Date parse(String source, ParsePosition pos)
DateFormat.parse(String, ParsePosition)
for more information.source
- A String
, part of which should be parsed.pos
- A ParsePosition
object with index and error index information
as described above.Date
parsed from the string. In case of error, returns null.NullPointerException
- if text or pos is null.boolean parse(String source, ParsePosition pos, Calendar calendar)
source
- The text to parse.pos
- On input, the position in the source to start parsing, on output, updated position.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.String getPattern()
Gets the pattern used by this parser.
SimpleDateFormat
compatibleTimeZone getTimeZone()
Gets the time zone used by this parser.
The default TimeZone
used to create a Date
when the TimeZone
is not specified by
the format pattern.
Object parseObject(String source) throws ParseException
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 © 2001–2020 The Apache Software Foundation. All rights reserved.