Package org.sqlite.date
Interface DateParser
-
- All Known Implementing Classes:
FastDateFormat
,FastDateParser
public interface DateParser
DateParser is the "missing" interface for the parsing methods ofDateFormat
.- Since:
- 3.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Locale
getLocale()
Get the locale used by this parser.String
getPattern()
Get the pattern used by this parser.TimeZone
getTimeZone()
Get 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).Object
parseObject(String source)
Parses text from a string to produce a Date.Object
parseObject(String source, ParsePosition pos)
Parse a date/time string according to the given parse position.
-
-
-
Method Detail
-
parse
Date parse(String source) throws ParseException
Equivalent to DateFormat.parse(String).See
DateFormat.parse(String)
for more information.- Parameters:
source
- AString
whose beginning should be parsed.- Returns:
- A
Date
parsed from the string - Throws:
ParseException
- if the beginning of the specified string cannot be parsed.
-
parse
Date parse(String source, ParsePosition pos)
Equivalent to DateFormat.parse(String, ParsePosition).See
DateFormat.parse(String, ParsePosition)
for more information.- Parameters:
source
- AString
, part of which should be parsed.pos
- AParsePosition
object with index and error index information as described above.- Returns:
- A
Date
parsed 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,
SimpleDateFormat
compatible
-
getTimeZone
TimeZone getTimeZone()
Get the time zone used by this parser.The default
TimeZone
used to create aDate
when theTimeZone
is not specified by the format pattern.- Returns:
- the time zone
-
getLocale
Locale getLocale()
Get the locale used by this parser.- Returns:
- the locale
-
parseObject
Object parseObject(String source) throws ParseException
Parses text from a string to produce a Date.- Parameters:
source
- AString
whose beginning should be parsed.- Returns:
- a
java.util.Date
object - Throws:
ParseException
- if the beginning of the specified string cannot be parsed.- See Also:
Format.parseObject(String)
-
parseObject
Object parseObject(String source, ParsePosition pos)
Parse a date/time string according to the given parse position.- Parameters:
source
- AString
whose beginning should be parsed.pos
- the parse position- Returns:
- a
java.util.Date
object - See Also:
DateFormat.parseObject(String, ParsePosition)
-
-