ICU Enhancement
This class is ICU's replacement for java..
ICU
Methods, fields, and other functionality specific to ICU are labeled 'ICU'.
DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates or time in a
language-independent manner. The date/time formatting subclass, such as SimpleDateFormat, allows for formatting
(i.e., date -> text), parsing (text -> date), and normalization. The date is represented as a Date
object or as the milliseconds since January 1, 1970, 00:00:00 GMT.
DateFormat helps you to format and parse dates for any locale. Your code can be completely independent of the locale conventions for months, days of the week, or even the calendar format: lunar vs. solar. It provides many class methods for obtaining default date/time formatters based on the default for a given locale and a number of formatting styles or arbitrary "skeletons".
MINUTE_SECOND for something like "13:45" or YEAR_ABBR_MONTH
for something like "Sept 2012".
To format a date for the current Locale, use one of the static factory methods:
myString = DateFormat.getDateInstance().format(myDate); myString = DateFormat.getPatternInstance(DateFormat.YEAR_ABBR_MONTH).format(myDate);
If you are formatting multiple numbers, it is more efficient to get the format and use it multiple times so that the system doesn't have to fetch the information about the local language and country conventions multiple times.
DateFormat df = DateFormat.getDateInstance();
for (int i = 0; i < a.length; ++i) {
output.println(df.format(myDate[i]) + "; ");
}
To format a date for a different Locale, specify it in the call to getDateInstance().
DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
You can use a DateFormat to parse also.
myDate = df.parse(myString);
There are many static factory methods available. Use getDateInstance to get the normal date format for that country. Use getTimeInstance to get the time format for that country. Use getDateTimeInstance to get a date and time format. You can pass in different options to these factory methods to control the length of the result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the locale, but generally:
Use getPatternInstance to format with a skeleton. Typically this is with a predefined skeleton, like
YEAR_ABBR_MONTH for something like "Sept 2012". If you don't want to use one of the predefined skeletons,
you can supply your own. The skeletons are like the patterns in SimpleDateFormat, except they:
You can also set the time zone on the format if you wish. If you want even more control over the format or parsing, (or want to give your users more control), you can try casting the DateFormat you get from the factory methods to a SimpleDateFormat. This will work for the majority of countries; just remember to put it in a try block in case you encounter an unusual one.
You can also use forms of the parse and format methods with ParsePosition and FieldPosition to allow you to
UFormat, NumberFormat, SimpleDateFormat, com.ibm.icu.util.Calendar , com.ibm.icu.util.GregorianCalendar , com.ibm.icu.util.TimeZone
| Modifier and Type | Class and Description |
|---|---|
| public static enum | DateFormat.BooleanAttribute
boolean attributes |
| public static class | DateFormat.Field
The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that DateFormat.formatToCharacterIterator() method returns. |
| public static enum | DateFormat.HourCycle
Hour Cycle |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| public static final String | ABBR_MONTH
ICU |
| public static final String | |
| public static final String | |
| public static final String | ABBR_QUARTER
ICU |
| public static final String | |
| public static final String | |
| public static final String | ABBR_UTC_TZ
ICU |
| public static final String | ABBR_WEEKDAY
ICU |
| public static final int | AM_PM_FIELD
FieldPosition selector for 'a' field alignment,
corresponding to the |
| public static final int | |
| private EnumSet | booleanAttributes
boolean attributes for this instance. |
| protected Calendar | calendar
The calendar that |
| private DisplayContext | |
| pack-priv static final int | |
| public static final int | DATE_FIELD
FieldPosition selector for 'd' field alignment,
corresponding to the |
| public static final List | DATE_SKELETONS
List of all of the date skeleton constants for iteration. |
| public static final String | DAY
ICU |
| public static final int | DAY_OF_WEEK_FIELD
FieldPosition selector for 'E' field alignment,
corresponding to the |
| public static final int | DAY_OF_WEEK_IN_MONTH_FIELD
FieldPosition selector for 'F' field alignment,
corresponding to the |
| public static final int | DAY_OF_YEAR_FIELD
FieldPosition selector for 'D' field alignment,
corresponding to the |
| public static final int | DEFAULT
Constant for default style pattern. |
| public static final int | |
| public static final int | ERA_FIELD
FieldPosition selector for 'G' field alignment,
corresponding to the |
| public static final int | |
| public static final int | FIELD_COUNT
ICU |
| public static final int | |
| public static final int | |
| public static final int | FULL
Constant for full style pattern. |
| public static final String | GENERIC_TZ
ICU |
| public static final String | HOUR
ICU |
| public static final int | HOUR0_FIELD
FieldPosition selector for 'K' field alignment,
corresponding to the |
| public static final int | HOUR1_FIELD
FieldPosition selector for 'h' field alignment,
corresponding to the |
| public static final String | HOUR24
ICU |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | HOUR_MINUTE
ICU |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final int | HOUR_OF_DAY0_FIELD
FieldPosition selector for 'H' field alignment,
corresponding to the |
| public static final int | HOUR_OF_DAY1_FIELD
FieldPosition selector for 'k' field alignment,
corresponding to the |
| public static final String | HOUR_TZ
ICU |
| public static final String | JP_ERA_2019_JA
Constant for Unicode string name of new (in 2019) Japanese calendar era, Japanese abbreviated version (Han, or fullwidth Latin for testing). |
| public static final String | JP_ERA_2019_NARROW
Constant for Unicode string name of new (in 2019) Japanese calendar era, root and Japanese narrow version (ASCII-range characters). |
| public static final String | JP_ERA_2019_ROOT
Constant for Unicode string name of new (in 2019) Japanese calendar era, root/English abbreviated version (ASCII-range characters). |
| public static final int | |
| public static final String | LOCATION_TZ
ICU |
| public static final int | LONG
Constant for long style pattern. |
| public static final int | MEDIUM
Constant for medium style pattern. |
| public static final int | MILLISECOND_FIELD
Alias for FRACTIONAL_SECOND_FIELD. |
| public static final int | |
| public static final String | MINUTE
ICU |
| public static final int | MINUTE_FIELD
FieldPosition selector for 'm' field alignment,
corresponding to the |
| public static final String | |
| public static final String | MONTH
ICU |
| public static final String | MONTH_DAY
ICU |
| public static final int | MONTH_FIELD
FieldPosition selector for 'M' field alignment,
corresponding to the |
| public static final String | |
| public static final int | NONE
ICU |
| public static final String | NUM_MONTH
ICU |
| public static final String | |
| public static final String | |
| protected NumberFormat | numberFormat
The number formatter that |
| public static final String | QUARTER
ICU |
| public static final int | |
| pack-priv static final int | RELATED_YEAR
ICU |
| public static final int | RELATIVE
ICU |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final String | SECOND
ICU |
| public static final int | SECOND_FIELD
FieldPosition selector for 's' field alignment,
corresponding to the |
| private int | serialVersionOnStream
Describes the version of |
| private static final long | |
| public static final int | SHORT
Constant for short style pattern. |
| public static final String | SPECIFIC_TZ
ICU |
| public static final int | |
| public static final String | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final List | TIME_SKELETONS
List of all of the time skeleton constants for iteration. |
| public static final int | TIMEZONE_FIELD
FieldPosition selector for 'z' field alignment,
corresponding to the |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | WEEK_OF_MONTH_FIELD
FieldPosition selector for 'W' field alignment,
corresponding to the |
| public static final int | WEEK_OF_YEAR_FIELD
FieldPosition selector for 'w' field alignment,
corresponding to the |
| public static final String | WEEKDAY
ICU |
| public static final String | YEAR
ICU |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final int | YEAR_FIELD
FieldPosition selector for 'y' field alignment,
corresponding to the |
| public static final String | YEAR_MONTH
ICU |
| public static final String | |
| public static final String | |
| public static final int | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | YEAR_QUARTER
ICU |
| public static final int | |
| public static final List | ZONE_SKELETONS
List of all of the zone skeleton constants for iteration. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Object | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| pack-priv static void | |
| public final StringBuffer | Returns: the formatted time string.must be a Number or a Date or a Calendar. obj, StringBuffer the string buffer for the returning time string. toAppendTo, FieldPosition keeps track of the position of the field
within the returned string.
On input: an alignment field,
if desired. On output: the offsets of the alignment field. For
example, given a time text "1996.07.10 AD at 15:08:56 PDT",
if the given fieldPosition is DateFormat.YEAR_FIELD, the
begin index and end index of fieldPosition will be set to
0 and 4, respectively.
Notice that if the same time field appears
more than once in a pattern, the fieldPosition will be set for the first
occurrence of that time field. For instance, formatting a Date to
the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
"h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
the begin index and end index of fieldPosition will be set to
5 and 8, respectively, for the first occurrence of the timezone
pattern character 'z'. fieldPosition)Implements abstract java. |
| public abstract StringBuffer | Returns: the formatted date/time string.a Calendar set to the date and time to be formatted
into a date/time string. When the calendar type is different from
the internal calendar held by this DateFormat instance, the date
and the time zone will be inherited from the input calendar, but
other calendar field values will be calculated by the internal calendar. cal, StringBuffer the string buffer for the returning date/time string. toAppendTo, FieldPosition keeps track of the position of the field
within the returned string.
On input: an alignment field,
if desired. On output: the offsets of the alignment field. For
example, given a time text "1996.07.10 AD at 15:08:56 PDT",
if the given fieldPosition is DateFormat.YEAR_FIELD, the
begin index and end index of fieldPosition will be set to
0 and 4, respectively.
Notice that if the same time field appears
more than once in a pattern, the fieldPosition will be set for the first
occurrence of that time field. For instance, formatting a Date to
the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
"h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
the begin index and end index of fieldPosition will be set to
5 and 8, respectively, for the first occurrence of the timezone
pattern character 'z'. fieldPosition)Formats a date into a date/time string. |
| public StringBuffer | Returns: the formatted date/time string.a Date to be formatted into a date/time string. date, StringBuffer the string buffer for the returning date/time string. toAppendTo, FieldPosition keeps track of the position of the field
within the returned string.
On input: an alignment field,
if desired. On output: the offsets of the alignment field. For
example, given a time text "1996.07.10 AD at 15:08:56 PDT",
if the given fieldPosition is DateFormat.YEAR_FIELD, the
begin index and end index of fieldPosition will be set to
0 and 4, respectively.
Notice that if the same time field appears
more than once in a pattern, the fieldPosition will be set for the first
occurrence of that time field. For instance, formatting a Date to
the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
"h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
the begin index and end index of fieldPosition will be set to
5 and 8, respectively, for the first occurrence of the timezone
pattern character 'z'. fieldPosition)Formats a Date into a date/time string. |
| public final String | |
| private static DateFormat | get(int
a value from 0 to 3 indicating the time format,
or -1 to indicate no date dateStyle, int a value from 0 to 3 indicating the time format,
or -1 to indicate no time timeStyle, ULocale the locale for the format loc, Calendar the calendar to be used, or null cal)Creates a DateFormat with the given time and/or date style in the given locale. |
| public static Locale[] | Returns: the set of locales for which DateFormats are installed.Returns the set of locales for which DateFormats are installed. |
| public static ULocale[] | |
| public boolean | getBooleanAttribute(DateFormat.
Returns the current value for the specified BooleanAttribute for this instance if attribute is missing false is returned. |
| public Calendar | Returns: the calendar associated with this date/time formatter.Returns the calendar associated with this date/time formatter. |
| public DisplayContext | Returns: the current DisplayContext setting for the specified typethe DisplayContext.Type whose value to return typeICU |
| public static final DateFormat | Returns: a date formatter.Returns the date formatter with the default formatting style
for the default |
| public static final DateFormat | Returns: a date formatter.the given formatting style. For example,
SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
formatting only affects a limited range of calendar days before or after the
current date, based on the CLDR <field type="day">/<relative> data: For example,
in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
dates are formatted using the corresponding non-relative style. style)Returns the date formatter with the given formatting style
for the default |
| public static final DateFormat | Returns: a date formatter.the given formatting style. For example,
SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
formatting only affects a limited range of calendar days before or after the
current date, based on the CLDR <field type="day">/<relative> data: For example,
in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
dates are formatted using the corresponding non-relative style. style, Locale the given locale. aLocale)Returns the date formatter with the given formatting style for the given locale. |
| public static final DateFormat | Returns: a date formatter.the given formatting style. For example,
SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
formatting only affects a limited range of calendar days before or after the
current date, based on the CLDR <field type="day">/<relative> data: For example,
in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
dates are formatted using the corresponding non-relative style. style, ULocale the given ulocale. locale)Returns the date formatter with the given formatting style for the given locale. |
| public static final DateFormat | getDateInstance(Calendar
The calendar system for which a date format is desired. cal, int The type of date format desired. This can be
dateStyle, Locale DateFormat#SHORT, DateFormat#MEDIUM,
etc.The locale for which the date format is desired. locale)Creates a |
| public static final DateFormat | getDateInstance(Calendar
The calendar system for which a date format is desired. cal, int The type of date format desired. This can be
dateStyle, ULocale DateFormat#SHORT, DateFormat#MEDIUM,
etc.The locale for which the date format is desired. locale)Creates a |
| public static final DateFormat | getDateInstance(Calendar
The calendar system for which a date format is desired. cal, int The type of date format desired. This can be
dateStyle)DateFormat#SHORT, DateFormat#MEDIUM,
etc.Creates a |
| public static final DateFormat | Returns: a date/time formatter.Returns the date/time formatter with the default formatting style
for the default |
| public static final DateFormat | Returns: a date/time formatter.the given date formatting style. For example,
SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
formatting only affects a limited range of calendar days before or after the
current date, based on the CLDR <field type="day">/<relative> data: For example,
in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
dates are formatted using the corresponding non-relative style. dateStyle, int the given time formatting style. For example,
SHORT for "h:mm a" in the US locale. Relative time styles are not currently
supported, and behave just like the corresponding non-relative style. timeStyle)Returns the date/time formatter with the given date and time
formatting styles for the default |
| public static final DateFormat | Returns: a date/time formatter.the given date formatting style. As currently implemented, relative date
formatting only affects a limited range of calendar days before or after the
current date, based on the CLDR <field type="day">/<relative> data: For example,
in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
dates are formatted using the corresponding non-relative style. dateStyle, int the given time formatting style. Relative time styles are not
currently supported, and behave just like the corresponding non-relative style. timeStyle, Locale the given locale. aLocale)Returns the date/time formatter with the given formatting styles for the given locale. |
| public static final DateFormat | Returns: a date/time formatter.the given date formatting style. As currently implemented, relative date
formatting only affects a limited range of calendar days before or after the
current date, based on the CLDR <field type="day">/<relative> data: For example,
in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
dates are formatted using the corresponding non-relative style. dateStyle, int the given time formatting style. Relative time styles are not
currently supported, and behave just like the corresponding non-relative style. timeStyle, ULocale the given ulocale. locale)Returns the date/time formatter with the given formatting styles for the given locale. |
| public static final DateFormat | getDateTimeInstance(Calendar
The calendar system for which a date/time format is desired. cal, int The type of date format desired. This can be
dateStyle, int DateFormat#SHORT, DateFormat#MEDIUM,
etc.The type of time format desired. This can be
timeStyle, Locale DateFormat#SHORT, DateFormat#MEDIUM,
etc.The locale for which the date/time format is desired. locale)Creates a |
| public static final DateFormat | getDateTimeInstance(Calendar
The calendar system for which a date/time format is desired. cal, int The type of date format desired. This can be
dateStyle, int DateFormat#SHORT, DateFormat#MEDIUM,
etc.The type of time format desired. This can be
timeStyle, ULocale DateFormat#SHORT, DateFormat#MEDIUM,
etc.The locale for which the date/time format is desired. locale)Creates a |
| public static final DateFormat | getDateTimeInstance(Calendar
The calendar system for which a date/time format is desired. cal, int The type of date format desired. This can be
dateStyle, int DateFormat#SHORT, DateFormat#MEDIUM,
etc.The type of time format desired. This can be
timeStyle)DateFormat#SHORT, DateFormat#MEDIUM,
etc.Creates a |
| public static final DateFormat | getInstance()
Returns a default date/time formatter that uses the SHORT style for both the date and the time. |
| public static final DateFormat | getInstance(Calendar
The calendar system for which a date/time format is desired. cal, Locale The locale for which the date/time format is desired. locale)Returns a date/time formatter that uses the SHORT style for both the date and the time. |
| public static final DateFormat | getInstance(Calendar
The calendar system for which a date/time format is desired. cal, ULocale The locale for which the date/time format is desired. locale)Returns a date/time formatter that uses the SHORT style for both the date and the time. |
| public static final DateFormat | getInstance(Calendar
The calendar system for which a date/time format is desired. cal)Returns a default date/time formatter that uses the SHORT style for both the date and the time. |
| public static final DateFormat | getInstanceForSkeleton(String
The skeleton that selects the fields to be formatted. (Uses the
skeleton)DateTimePatternGenerator.) This can be DateFormat#ABBR_MONTH,
DateFormat#MONTH_WEEKDAY_DAY, etc.ICU |
| public static final DateFormat | getInstanceForSkeleton(String
The skeleton that selects the fields to be formatted. (Uses the
skeleton, Locale DateTimePatternGenerator.) This can be DateFormat#ABBR_MONTH,
DateFormat#MONTH_WEEKDAY_DAY, etc.The locale for which the date/time format is desired. locale)ICU |
| public static final DateFormat | getInstanceForSkeleton(String
The skeleton that selects the fields to be formatted. (Uses the
skeleton, ULocale DateTimePatternGenerator.) This can be DateFormat#ABBR_MONTH,
DateFormat#MONTH_WEEKDAY_DAY, etc.The locale for which the date/time format is desired. locale)ICU |
| public static final DateFormat | getInstanceForSkeleton(Calendar
The calendar system for which a date/time format is desired. cal, String The skeleton that selects the fields to be formatted. (Uses the
skeleton, Locale DateTimePatternGenerator.) This can be
DateFormat#ABBR_MONTH, DateFormat#MONTH_WEEKDAY_DAY,
etc.The locale for which the date/time format is desired. locale)ICU |
| public static final DateFormat | getInstanceForSkeleton(Calendar
The calendar system for which a date/time format is desired. cal, String The skeleton that selects the fields to be formatted. (Uses the
skeleton, ULocale DateTimePatternGenerator.) This can be
DateFormat#ABBR_MONTH, DateFormat#MONTH_WEEKDAY_DAY,
etc.The locale for which the date/time format is desired. locale)ICU |
| public NumberFormat | Returns: the number formatter which this date/time formatter uses.Returns the number formatter which this date/time formatter uses to format and parse a time. |
| public static final DateFormat | getPatternInstance(String
The skeleton that selects the fields to be formatted. (Uses the
skeleton)DateTimePatternGenerator.) This can be DateFormat#ABBR_MONTH,
DateFormat#MONTH_WEEKDAY_DAY, etc.ICU |
| public static final DateFormat | getPatternInstance(String
The skeleton that selects the fields to be formatted. (Uses the
skeleton, Locale DateTimePatternGenerator.) This can be DateFormat#ABBR_MONTH,
DateFormat#MONTH_WEEKDAY_DAY, etc.The locale for which the date/time format is desired. locale)ICU |
| public static final DateFormat | getPatternInstance(String
The skeleton that selects the fields to be formatted. (Uses the
skeleton, ULocale DateTimePatternGenerator.) This can be DateFormat#ABBR_MONTH,
DateFormat#MONTH_WEEKDAY_DAY, etc.The locale for which the date/time format is desired. locale)ICU |
| public static final DateFormat | getPatternInstance(Calendar
The calendar system for which a date/time format is desired. cal, String The skeleton that selects the fields to be formatted. (Uses the
skeleton, Locale DateTimePatternGenerator.) This can be
DateFormat#ABBR_MONTH, DateFormat#MONTH_WEEKDAY_DAY,
etc.The locale for which the date/time format is desired. locale)ICU |
| public static final DateFormat | getPatternInstance(Calendar
The calendar system for which a date/time format is desired. cal, String The skeleton that selects the fields to be formatted. (Uses the
skeleton, ULocale DateTimePatternGenerator.) This can be
DateFormat#ABBR_MONTH, DateFormat#MONTH_WEEKDAY_DAY,
etc.The locale for which the date/time format is desired. locale)ICU |
| public static final DateFormat | Returns: a time formatter.Gets the time formatter with the default formatting style
for the default |
| public static final DateFormat | Returns: a time formatter.the given formatting style. For example,
SHORT for "h:mm a" in the US locale. Relative time styles are not currently
supported, and behave just like the corresponding non-relative style. style)Returns the time formatter with the given formatting style
for the default |
| public static final DateFormat | Returns: a time formatter.the given formatting style. For example,
SHORT for "h:mm a" in the US locale. Relative time styles are not currently
supported, and behave just like the corresponding non-relative style. style, Locale the given locale. aLocale)Returns the time formatter with the given formatting style for the given locale. |
| public static final DateFormat | Returns: a time formatter.the given formatting style. For example,
SHORT for "h:mm a" in the US locale. Relative time styles are not currently
supported, and behave just like the corresponding non-relative style. style, ULocale the given ulocale. locale)Returns the time formatter with the given formatting style for the given locale. |
| public static final DateFormat | getTimeInstance(Calendar
The calendar system for which a time format is desired. cal, int The type of time format desired. This can be
timeStyle, Locale DateFormat#SHORT, DateFormat#MEDIUM,
etc.The locale for which the time format is desired. locale)Creates a |
| public static final DateFormat | getTimeInstance(Calendar
The calendar system for which a time format is desired. cal, int The type of time format desired. This can be
timeStyle, ULocale DateFormat#SHORT, DateFormat#MEDIUM,
etc.The locale for which the time format is desired. locale)Creates a |
| public static final DateFormat | getTimeInstance(Calendar
The calendar system for which a time format is desired. cal, int The type of time format desired. This can be
timeStyle)DateFormat#SHORT, DateFormat#MEDIUM,
etc.Creates a |
| public TimeZone | Returns: the time zone associated with the calendar of DateFormat.Returns the time zone. |
| public int | |
| public boolean | isCalendarLenient()
Returns whether date/time parsing in the encapsulated Calendar object is lenient. |
| public boolean | isLenient()
Returns whether both date/time parsing in the encapsulated Calendar object and DateFormat whitespace & numeric processing is lenient. |
| public Date | |
| public abstract void | parse(String
The date/time string to be parsed text, Calendar The calendar set on input to the date and time to be used
for missing values in the date/time string being parsed,
and set on output to the parsed date/time. In general, this
should be initialized before calling this method - either
cleared or set to the current date, depending on desired
behavior. If this parse fails, the calendar may still
have been modified. When the calendar type is different
from the internal calendar held by this DateFormat
instance, calendar field values will be parsed based
on the internal calendar initialized with the time and
the time zone taken from this calendar, then the
parse result (time in milliseconds and time zone) will
be set back to this calendar. cal, ParsePosition On input, the position at which to start parsing; on
output, the position at which parsing terminated, or the
start position if the parse failed. pos)Parses a date/time string according to the given parse position. |
| public Date | Returns: A Date, or null if the input could not be parsedThe date/time string to be parsed text, ParsePosition On input, the position at which to start parsing; on
output, the position at which parsing terminated, or the
start position if the parse failed. pos)Parses a date/time string according to the given parse position. |
| public Object | parseObject(String
A source, ParsePosition String, part of which should be parsed.A pos)ParsePosition object with index and error
index information as described above.Implements abstract java. |
| private void | |
| public DateFormat | setBooleanAttribute(DateFormat.
Sets a boolean attribute for this instance. |
| public void | setCalendar(Calendar
the new Calendar to be used by the date format newCalendar)Sets the calendar to be used by this date format. |
| public void | setCalendarLenient(boolean
when true, Calendar parsing is lenient lenient)Specifies whether date/time parsing in the encapsulated Calendar object should be lenient. |
| public void | |
| public void | setLenient(boolean
True specifies date/time interpretation to be lenient. lenient)Specifies whether date/time parsing is to be lenient. |
| public void | |
| public void | setTimeZone(TimeZone
the given new time zone. zone)Sets the time zone for the calendar of this DateFormat object. |