|
Oracle® Database Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.text.Format | +--oracle.i18n.text.OraDateFormat
The OraDateFormat
class is an abstract class to do
locale-sensitive formatting and parsing between date/time and string.
It supports Oracle date/time formatting behavior.
OraSimpleDateFormat
,
Serialized FormNested Class Summary |
Nested classes inherited from class java.text.Format |
Format.Field |
Field Summary | |
static int |
ALL_FIELD
Constant for ALL_FIELD alignment. |
static int |
AM_PM_FIELD
Constant for AM_PM_FIELD alignment. |
protected Calendar |
calendar
The calendar that this OraDateFormat object uses to calculate
the date/time field values. |
static int |
CENTRY_FIELD
Constant for CENTRY_FIELD alignment. |
static int |
DATE_FIELD
Constant for DATE_FIELD alignment. |
static int |
DAY_OF_WEEK_FIELD
Constant for DAY_OF_WEEK_FIELD alignment. |
static int |
DAY_OF_YEAR_FIELD
Constant for DAY_OF_YEAR_FIELD alignment. |
static int |
DEFAULT
Constant for DEFAULT format style. |
static int |
ERA_FIELD
Constant for ERA_FIELD alignment. |
static int |
HOUR_FIELD
Constant for HOUR_FIELD alignment. |
static int |
HOUR_OF_DAY_FIELD
Constant for HOUR_OF_DAY_FIELD alignment. |
static int |
ISO_WEEK_OF_YEAR_FIELD
Constant for ISO_WEEK_OF_YEAR_FIELD alignment. |
static int |
ISO_YEAR_FIELD
Constant for ISO_YEAR_FIELD alignment. |
static int |
JULIAN_DAY_FIELD
Constant for JULIAN_DAY_FIELD alignment. |
static int |
LONG
Constant for date LONG format style. |
static int |
MILLISECOND_FIELD
Constant for MILLISECOND_FIELD alignment. |
static int |
MINUTE_FIELD
Constant for MINUTE_FIELD alignment. |
static int |
MONTH_FIELD
Constant for MONTH_FIELD alignment. |
static int |
QUARTER_OF_YEAR_FIELD
Constant for QUARTER_OF_YEAR_FIELD alignment. |
static int |
SECOND_FIELD
Constant for SECOND_FIELD alignment. |
static int |
SECONDS_FIELD
Constant for SECONDS_FIELD alignment. |
static int |
SHORT
Constant for date/time SHORT format style. |
static int |
TEXT_FIELD
Constant for TEXT_FIELD alignment. |
static int |
TIMEZONE_FIELD
Constant for TIMEZONE_FIELD alignment. |
static int |
WEEK_OF_MONTH_FIELD
Constant for WEEK_OF_MONTH_FIELD alignment. |
static int |
WEEK_OF_YEAR_FIELD
Constant for WEEK_OF_YEAR_FIELD alignment. |
static int |
YEAR_FIELD
Constant for YEAR_FIELD alignment. |
Constructor Summary | |
OraDateFormat()
|
Method Summary | |
Object |
clone()
Overrides the clone method. |
boolean |
equals(Object obj)
Overrides the equals method. |
String |
format(Date date)
Formats a Date object into a date/time string. |
abstract StringBuffer |
format(Date date,
StringBuffer toAppendTo,
FieldPosition fieldPosition)
Formats a Date object into a date/time string.
|
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition fieldPosition)
Formats an object into a date/time string. |
Calendar |
getCalendar()
Returns the calendar associated with this date/time formatter. |
static oracle.i18n.text.OraDateFormat |
getDateInstance()
Deprecated. As of Oracle Database 10g Release 2 (10.2), replaced by getDateInstance(int, Locale) |
static oracle.i18n.text.OraDateFormat |
getDateInstance(int style)
Deprecated. As of Oracle Database 10g Release 2 (10.2), replaced by getDateInstance(int, Locale) |
static oracle.i18n.text.OraDateFormat |
getDateInstance(int style,
Locale locale)
Returns a date formatter that uses the given date formatting style for the given locale. |
static oracle.i18n.text.OraDateFormat |
getDateInstance(int style,
oracle.i18n.util.OraLocaleInfo localeInfo)
Returns a date formatter that uses the given date formatting style for the given OraLocaleInfo object. |
static oracle.i18n.text.OraDateFormat |
getDateTimeInstance()
Deprecated. As of Oracle Database 10g Release 2 (10.2), replaced by getDateTimeInstance(int, Locale) |
static oracle.i18n.text.OraDateFormat |
getDateTimeInstance(int dateStyle)
Deprecated. As of Oracle Database 10g Release 2 (10.2), replaced by getDateTimeInstance(int, Locale) |
static oracle.i18n.text.OraDateFormat |
getDateTimeInstance(int dateStyle,
Locale locale)
Returns a date/time formatter that uses the given date formatting style and the default time formatting style for the given locale. |
static oracle.i18n.text.OraDateFormat |
getDateTimeInstance(int dateStyle,
oracle.i18n.util.OraLocaleInfo localeInfo)
Returns a date/time formatter that uses the given date formatting style and the default time formatting style for the given OraLocaleInfo object. |
static String |
getDefaultDateFormatPattern(int style,
Locale locale)
Returns the default date format pattern for the given date formatting style and the given locale. |
static String |
getDefaultDateFormatPattern(int style,
oracle.i18n.util.OraLocaleInfo localeInfo)
Returns the default date format pattern for the given date formatting style and the given OraLocaleInfo object. |
static String |
getDefaultDateTimeFormatPattern(int dateStyle,
Locale locale)
Returns the default date/time format pattern for the given date formatting style and the given locale. |
static String |
getDefaultDateTimeFormatPattern(int dateStyle,
oracle.i18n.util.OraLocaleInfo localeInfo)
Returns the default date/time format pattern for the given date formatting style and the given OraLocaleInfo object. |
static String |
getDefaultTimeFormatPattern(Locale locale)
Returns the default time format pattern for the given locale. |
static String |
getDefaultTimeFormatPattern(oracle.i18n.util.OraLocaleInfo localeInfo)
Returns the default time format pattern for the given OraLocaleInfo object. |
static oracle.i18n.text.OraDateFormat |
getInstance()
Deprecated. As of Oracle Database 10g Release 2 (10.2), replaced by getDateTimeInstance(int, Locale) |
static oracle.i18n.text.OraDateFormat |
getTimeInstance()
Deprecated. As of Oracle Database 10g Release 2 (10.2), replaced by getTimeInstance(Locale) |
static oracle.i18n.text.OraDateFormat |
getTimeInstance(Locale locale)
Returns a time formatter for the given locale. |
static oracle.i18n.text.OraDateFormat |
getTimeInstance(oracle.i18n.util.OraLocaleInfo localeInfo)
Returns a time formatter for the given OraLocaleInfo object. |
TimeZone |
getTimeZone()
Returns the time zone associated with the calendar of this formatter. |
Date |
parse(String text)
Parses a date/time string into a date. |
abstract Date |
parse(String text,
ParsePosition pos)
Parses a date/time string into a date, starting from the given parse position. |
Object |
parseObject(String text,
ParsePosition pos)
Parses a date/time string into a ( Date ) object, starting from
the given parse position. |
void |
setCalendar(Calendar calendar)
Sets the given calendar to be used by this date/time formatter. |
void |
setTimeZone(TimeZone timezone)
Sets the given time zone to be used by the calendar of this formatter. |
Methods inherited from class java.text.Format |
format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ERA_FIELD
ERA_FIELD
alignment. Used to specify the
field position for formatting.
public static final int YEAR_FIELD
YEAR_FIELD
alignment. Used to specify the
field position for formatting.
public static final int MONTH_FIELD
MONTH_FIELD
alignment. Used to specify the
field position for formatting.
public static final int DATE_FIELD
DATE_FIELD
alignment. Used to specify the
field position for formatting.
public static final int HOUR_OF_DAY_FIELD
HOUR_OF_DAY_FIELD
alignment. Used to specify the
field position for formatting. The HOUR_OF_DAY_FIELD
is used for zero-base, 24-hour clock (0 ~ 23).
public static final int MINUTE_FIELD
MINUTE_FIELD
alignment. Used to specify the
field position for formatting.
public static final int SECOND_FIELD
SECOND_FIELD
alignment. Used to specify the
field position for formatting.
public static final int MILLISECOND_FIELD
MILLISECOND_FIELD
alignment. Used to specify the
field position for formatting.
public static final int DAY_OF_WEEK_FIELD
DAY_OF_WEEK_FIELD
alignment. Used to specify the
field position for formatting.
public static final int DAY_OF_YEAR_FIELD
DAY_OF_YEAR_FIELD
alignment. Used to specify the
field position for formatting.
public static final int WEEK_OF_YEAR_FIELD
WEEK_OF_YEAR_FIELD
alignment. Used to specify
the field position for formatting.
public static final int WEEK_OF_MONTH_FIELD
WEEK_OF_MONTH_FIELD
alignment. Used to specify
the field position for formatting.
public static final int AM_PM_FIELD
AM_PM_FIELD
alignment. Used to specify
the field position for formatting.
public static final int HOUR_FIELD
HOUR_FIELD
alignment. Used to specify
the field position for formatting. The HOUR_FIELD
is used for
one-base, 12-hour clock (1 ~ 12).
public static final int TIMEZONE_FIELD
TIMEZONE_FIELD
alignment. Used to specify
the field position for formatting.
public static final int ALL_FIELD
ALL_FIELD
alignment. Used to specify
the field position for formatting. The ALL_FIELD
is used to
indicate all fields specified in a format pattern.
public static final int CENTRY_FIELD
CENTRY_FIELD
alignment. Used to specify
the field position for formatting. Centry is one greater than the first
two digits of a four-digit year.
public static final int JULIAN_DAY_FIELD
JULIAN_DAY_FIELD
alignment. Used to specify
the field position for formatting. The Julian day is number of
days since January 1, 4712 BC.
public static final int QUARTER_OF_YEAR_FIELD
QUARTER_OF_YEAR_FIELD
alignment. Used to specify
the field position for formatting.
public static final int SECONDS_FIELD
SECONDS_FIELD
alignment. Used to specify
the field position for formatting. The SECONDS_FIELD
is for number of seconds past midnight.
public static final int TEXT_FIELD
TEXT_FIELD
alignment. Used to specify
the field position for formatting.
public static final int ISO_YEAR_FIELD
ISO_YEAR_FIELD
alignment. Used to specify
the field position for formatting.
public static final int ISO_WEEK_OF_YEAR_FIELD
ISO_WEEK_OF_YEAR_FIELD
alignment. Used to
specify the field position for formatting.
public static final int SHORT
SHORT
format style.
public static final int LONG
LONG
format style.
public static final int DEFAULT
DEFAULT
format style. For date, it is equivalent
to Oracle server default date format. For time, it is equivalent to
the time SHORT
format style.
protected Calendar calendar
OraDateFormat
object uses to calculate
the date/time field values. Subclasses should initialize the
calendar
object accordingly based on the locale associated
with this OraDateFormat
object.
Constructor Detail |
public OraDateFormat()
Method Detail |
public static final oracle.i18n.text.OraDateFormat getDateInstance()
getDateInstance(int, Locale)
public static final oracle.i18n.text.OraDateFormat getDateInstance(int style)
getDateInstance(int, Locale)
style
- the given date formatting style; options are
SHORT
, LONG
or DEFAULT
public static final oracle.i18n.text.OraDateFormat getDateInstance(int style, Locale locale)
style
- the given date formatting style; options are
SHORT
, LONG
or DEFAULT
locale
- the given locale
public static final oracle.i18n.text.OraDateFormat getDateInstance(int style, oracle.i18n.util.OraLocaleInfo localeInfo)
OraLocaleInfo
object.
style
- the given date formatting style; options are
SHORT
, LONG
or DEFAULT
localeInfo
- the given OraLocaleInfo
object
IllegalArgumentException
- if the given date formatting style
is invalidpublic static final oracle.i18n.text.OraDateFormat getDateTimeInstance()
getDateTimeInstance(int, Locale)
public static final oracle.i18n.text.OraDateFormat getDateTimeInstance(int dateStyle)
getDateTimeInstance(int, Locale)
dateStyle
- the given date formatting style; options are
SHORT
, LONG
or DEFAULT
public static final oracle.i18n.text.OraDateFormat getDateTimeInstance(int dateStyle, Locale locale)
dateStyle
- the given date formatting style; options are
SHORT
, LONG
or DEFAULT
locale
- the given locale
public static final oracle.i18n.text.OraDateFormat getDateTimeInstance(int dateStyle, oracle.i18n.util.OraLocaleInfo localeInfo)
OraLocaleInfo
object.
dateStyle
- the given date formatting style; options are
SHORT
, LONG
or DEFAULT
localeInfo
- the given OraLocaleInfo
object
IllegalArgumentException
- if the given date formatting style
is invalidpublic static final oracle.i18n.text.OraDateFormat getInstance()
getDateTimeInstance(int, Locale)
public static final oracle.i18n.text.OraDateFormat getTimeInstance()
getTimeInstance(Locale)
public static final oracle.i18n.text.OraDateFormat getTimeInstance(Locale locale)
locale
- the given locale
public static final oracle.i18n.text.OraDateFormat getTimeInstance(oracle.i18n.util.OraLocaleInfo localeInfo)
OraLocaleInfo
object.
localeInfo
- the given OraLocaleInfo
object
public final String format(Date date)
Date
object into a date/time string.
date
- the date/time object to be formatted into a
date/time string
public abstract StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
Date
object into a date/time string.
Sets field position if it is needed.
date
- the date/time object to be formatted into a date/time string.toAppendTo
- the string buffer to be appended with the formatted
date/time string.fieldPosition
- 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.
public final StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition fieldPosition)
format
in class Format
obj
- the object to be formatted into a date/time string. It must be
an instance of Date
or Number
class.toAppendTo
- the string buffer to be appended with the formatted
date/time string.fieldPosition
- 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.
IllegalArgumentException
- if the given object is neither an
instance of Date
class nor an instance of
Number
classpublic Date parse(String text) throws ParseException
text
- the date/time string to be parsed
Date
object corresponding to the date/time string
ParseException
- if the format pattern associated with this
formatter is not valid for parsing or the given date/time
string cannot be parsed into a Date
objectpublic abstract Date parse(String text, ParsePosition pos)
text
- the date/time string.pos
- 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.
Date
objectpublic Object parseObject(String text, ParsePosition pos)
Date
) object, starting from
the given parse position. It is a convenient method which simply calls the
parse(String, ParsePostion)
method.
parseObject
in class Format
parse(String, ParsePosition)
public static String getDefaultDateFormatPattern(int style, Locale locale)
style
- the given date formatting stylelocale
- the given locale
public static String getDefaultDateFormatPattern(int style, oracle.i18n.util.OraLocaleInfo localeInfo)
OraLocaleInfo
object.
style
- the given date formatting stylelocaleInfo
- the given OraLocaleInfo
object
public static String getDefaultDateTimeFormatPattern(int dateStyle, Locale locale)
dateStyle
- the given date formatting stylelocale
- the given locale
public static String getDefaultDateTimeFormatPattern(int dateStyle, oracle.i18n.util.OraLocaleInfo localeInfo)
OraLocaleInfo
object.
dateStyle
- the given date formatting stylelocaleInfo
- the given OraLocaleInfo
object
public static String getDefaultTimeFormatPattern(Locale locale)
locale
- the given locale
public static String getDefaultTimeFormatPattern(oracle.i18n.util.OraLocaleInfo localeInfo)
OraLocaleInfo
object.
localeInfo
- the given OraLocaleInfo
object
public Calendar getCalendar()
Calendar
object associated with this formatterpublic void setCalendar(Calendar calendar)
calendar
- the given Calendar
object
to be used by this formatterpublic TimeZone getTimeZone()
TimeZone
object associated with the calendar
of this formatterpublic void setTimeZone(TimeZone timezone)
timezone
- the given TimeZone
object to be used by
the calendar of this formatterpublic Object clone()
clone
method.
clone
in class Format
public boolean equals(Object obj)
equals
method.
equals
in class Object
obj
- an object to be compared
true
if two objects are identical, otherwise
false
|
Oracle® Database Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |