Package oracle.i18n.text
Class OraSimpleDateFormat
- java.lang.Object
-
- java.text.Format
-
- oracle.i18n.text.OraDateFormat
-
- oracle.i18n.text.OraSimpleDateFormat
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class OraSimpleDateFormat extends OraDateFormat
TheOraSimpleDateFormat
class is a concrete class to do locale-sensitive formatting and parsing between date/time and string. It supports Oracle date/time formatting behavior.- See Also:
OraDateFormat
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.text.Format
Format.Field
-
-
Field Summary
-
Fields inherited from class oracle.i18n.text.OraDateFormat
ALL_FIELD, AM_PM_FIELD, calendar, CENTRY_FIELD, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, HOUR_FIELD, HOUR_OF_DAY_FIELD, ISO_WEEK_OF_YEAR_FIELD, ISO_YEAR_FIELD, JULIAN_DAY_FIELD, LONG, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, QUARTER_OF_YEAR_FIELD, SECOND_FIELD, SECONDS_FIELD, SHORT, TEXT_FIELD, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
-
-
Constructor Summary
Constructors Constructor Description OraSimpleDateFormat()
Deprecated.As of Oracle Database 10g Release 2 (10.2), replaced byOraSimpleDateFormat(String, Locale)
OraSimpleDateFormat(String pattern)
Deprecated.As of Oracle Database 10g Release 2 (10.2), replaced byOraSimpleDateFormat(String, Locale)
OraSimpleDateFormat(String pattern, Locale locale)
Constructs anOraSimpleDateFormat
object that uses the given format pattern for the given locale.OraSimpleDateFormat(String pattern, OraDateFormatSymbols symbols)
Deprecated.As of Oracle Database 10g Release 2 (10.2), replaced byOraSimpleDateFormat(String, OraDateFormatSymbols, Locale)
OraSimpleDateFormat(String pattern, OraDateFormatSymbols symbols, Locale locale)
Constructs anOraSimpleDateFormat
object that uses the given format pattern and the given Oracle date/time symbols for the given locale.OraSimpleDateFormat(String pattern, OraDateFormatSymbols symbols, OraLocaleInfo localeInfo)
Constructs anOraSimpleDateFormat
object that uses the given format pattern and the given Oracle date/time symbols for the givenOraLocaleInfo
object.OraSimpleDateFormat(String pattern, OraLocaleInfo localeInfo)
Constructs anOraSimpleDateFormat
object that uses the given format pattern for the givenOraLocaleInfo
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyPattern(String pattern)
Applies the given format pattern of this date/time formatter.Object
clone()
Overrides theclone
method.boolean
equals(Object object)
Overrides theequals
method.StringBuffer
format(Date date, StringBuffer toAppendTo, FieldPosition pos)
Formats aDate
object into a date/time string.Locale
getLocale()
Returns the locale associated with this date/time formatter.OraDateFormatSymbols
getOraDateFormatSymbols()
Returns the Oracle date/time format symbols or translations used in this formatter.int
hashCode()
Overrides thehashCode
method.Date
parse(String text, ParsePosition pos)
Parses a date/time string into aDate
object, starting from the given parse position.void
setOraDateFormatSymbols(OraDateFormatSymbols sym)
Sets the Oracle date/time format symbols or translations to the givenOraDateFormatSymbols
object for this formatter.String
toPattern()
Returns the format pattern associated with this date/time formatter.-
Methods inherited from class oracle.i18n.text.OraDateFormat
format, format, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDefaultDateFormatPattern, getDefaultDateFormatPattern, getDefaultDateTimeFormatPattern, getDefaultDateTimeFormatPattern, getDefaultTimeFormatPattern, getDefaultTimeFormatPattern, getInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, parse, parseObject, setCalendar, setTimeZone
-
Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject
-
-
-
-
Constructor Detail
-
OraSimpleDateFormat
public OraSimpleDateFormat()
Deprecated.As of Oracle Database 10g Release 2 (10.2), replaced byOraSimpleDateFormat(String, Locale)
Constructs anOraSimpleDateFormat
object that uses the default date/time formatting sytle for the default locale.
-
OraSimpleDateFormat
public OraSimpleDateFormat(String pattern) throws ParseException
Deprecated.As of Oracle Database 10g Release 2 (10.2), replaced byOraSimpleDateFormat(String, Locale)
Constructs anOraSimpleDateFormat
object that uses the given format pattern for the default locale.- Parameters:
pattern
- the given format pattern- Throws:
ParseException
- if the format pattern is invalid
-
OraSimpleDateFormat
public OraSimpleDateFormat(String pattern, Locale locale) throws ParseException
Constructs anOraSimpleDateFormat
object that uses the given format pattern for the given locale.- Parameters:
pattern
- the given format patternlocale
- the given locale- Throws:
ParseException
- if the format pattern is invalid
-
OraSimpleDateFormat
public OraSimpleDateFormat(String pattern, OraLocaleInfo localeInfo) throws ParseException
Constructs anOraSimpleDateFormat
object that uses the given format pattern for the givenOraLocaleInfo
object.- Parameters:
pattern
- the given format patternlocaleInfo
- the givenOraLocaleInfo
object- Throws:
ParseException
- if the format pattern is invalid
-
OraSimpleDateFormat
public OraSimpleDateFormat(String pattern, OraDateFormatSymbols symbols) throws ParseException
Deprecated.As of Oracle Database 10g Release 2 (10.2), replaced byOraSimpleDateFormat(String, OraDateFormatSymbols, Locale)
Constructs anOraSimpleDateFormat
object that uses the given format pattern and the given Oracle date/time symbols for the default locale.- Parameters:
pattern
- the given format patternsymbols
- the given Oracle date/time symbols- Throws:
ParseException
- if the format pattern is invalid
-
OraSimpleDateFormat
public OraSimpleDateFormat(String pattern, OraDateFormatSymbols symbols, Locale locale) throws ParseException
Constructs anOraSimpleDateFormat
object that uses the given format pattern and the given Oracle date/time symbols for the given locale.- Parameters:
pattern
- the given format patternsymbols
- the given Oracle date/time symbolslocale
- the given locale- Throws:
ParseException
- if the format pattern is invalid
-
OraSimpleDateFormat
public OraSimpleDateFormat(String pattern, OraDateFormatSymbols symbols, OraLocaleInfo localeInfo) throws ParseException
Constructs anOraSimpleDateFormat
object that uses the given format pattern and the given Oracle date/time symbols for the givenOraLocaleInfo
object.- Parameters:
pattern
- the given format patternsymbols
- the given Oracle date/time symbolslocaleInfo
- the givenOraLocaleInfo
object- Throws:
ParseException
- if the format pattern is invalid
-
-
Method Detail
-
applyPattern
public void applyPattern(String pattern) throws ParseException
Applies the given format pattern of this date/time formatter.- Parameters:
pattern
- the given format pattern- Throws:
ParseException
- if the format pattern is invalid
-
format
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos)
Formats aDate
object into a date/time string. Sets field position if needed.- Specified by:
format
in classOraDateFormat
- Parameters:
date
- the date/time object to be formatted.toAppendTo
- the string buffer to be appended with the formatted date/time string.pos
- to be used to get offsets of a given field in the returned string buffer. On input, the alignment field of which the offsets are to be returned. On output, the offsets of the alignment field in the returned string buffer.- Returns:
- the string buffer appended with the formatted date/time string
- Throws:
IllegalArgumentException
- if any error occurs in the format operation
-
getOraDateFormatSymbols
public OraDateFormatSymbols getOraDateFormatSymbols()
Returns the Oracle date/time format symbols or translations used in this formatter. The symbols include: month names, abbreviated month names, names of day-of-the-week, abbreviated names of day-of-the-week, era strings, and meridian indicators.- Returns:
- an
OracleDateFormatSymbols
object - See Also:
OraDateFormatSymbols
-
setOraDateFormatSymbols
public void setOraDateFormatSymbols(OraDateFormatSymbols sym)
Sets the Oracle date/time format symbols or translations to the givenOraDateFormatSymbols
object for this formatter.- Parameters:
sym
- the givenOraDateFormatSymbols
object
-
parse
public Date parse(String text, ParsePosition pos)
Parses a date/time string into aDate
object, starting from the given parse position.- Specified by:
parse
in classOraDateFormat
- Parameters:
text
- the date/time stringpos
- indicates where to start the parsing on input. On output, returns where the parse ends if parsing succeeds, or the start index if it fails.- Returns:
- a
Date
object - Throws:
IllegalArgumentException
- if the format pattern associated with this formatter is not valid for parsing or the given date/time string cannot be parsed into aDate
object
-
toPattern
public String toPattern()
Returns the format pattern associated with this date/time formatter.- Returns:
- a format pattern string
-
getLocale
public Locale getLocale()
Returns the locale associated with this date/time formatter.- Returns:
- a Java
Locale
object
-
clone
public Object clone()
Overrides theclone
method.- Overrides:
clone
in classOraDateFormat
- Returns:
- a cloned object
-
equals
public boolean equals(Object object)
Overrides theequals
method.- Overrides:
equals
in classOraDateFormat
- Parameters:
object
- an object to be compared- Returns:
true
if two objects are identical, otherwisefalse
-
-