Package org.sqlite.date
Interface DateParser
- All Known Implementing Classes:
FastDateFormat,FastDateParser
public interface DateParser
DateParser is the "missing" interface for the parsing methods of
DateFormat.- Since:
- 3.2
-
Method Summary
Modifier and TypeMethodDescriptionGet the locale used by this parser.Get the pattern used by this parser.Get the time zone used by this parser.Equivalent to DateFormat.parse(String).parse(String source, ParsePosition pos) Equivalent to DateFormat.parse(String, ParsePosition).parseObject(String source) Parses text from a string to produce a Date.parseObject(String source, ParsePosition pos) Parse a date/time string according to the given parse position.
-
Method Details
-
parse
Equivalent to DateFormat.parse(String).See
DateFormat.parse(String)for more information.- Parameters:
source- AStringwhose beginning should be parsed.- Returns:
- A
Dateparsed from the string - Throws:
ParseException- if the beginning of the specified string cannot be parsed.
-
parse
Equivalent to DateFormat.parse(String, ParsePosition).See
DateFormat.parse(String, ParsePosition)for more information.- Parameters:
source- AString, part of which should be parsed.pos- AParsePositionobject with index and error index information as described above.- Returns:
- A
Dateparsed from the string. In case of error, returns null. - Throws:
NullPointerException- if text or pos is null.
-
getPattern
String getPattern()Get the pattern used by this parser.- Returns:
- the pattern,
SimpleDateFormatcompatible
-
getTimeZone
TimeZone getTimeZone()Get the time zone used by this parser.The default
TimeZoneused to create aDatewhen theTimeZoneis not specified by the format pattern.- Returns:
- the time zone
-
getLocale
Locale getLocale()Get the locale used by this parser.- Returns:
- the locale
-
parseObject
Parses text from a string to produce a Date.- Parameters:
source- AStringwhose beginning should be parsed.- Returns:
- a
java.util.Dateobject - Throws:
ParseException- if the beginning of the specified string cannot be parsed.- See Also:
-
parseObject
Parse a date/time string according to the given parse position.- Parameters:
source- AStringwhose beginning should be parsed.pos- the parse position- Returns:
- a
java.util.Dateobject - See Also:
-