|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.rim.device.api.i18n.Format
|
+--net.rim.device.api.i18n.DateFormat
|
+--net.rim.device.api.i18n.SimpleDateFormat
Formats and parses dates in a locale-sensitive manner.
Formatting is done employing a user-defined pattern string constructed some or all of the following symbols:
| Symbol | Meaning | Presentation | Example |
|---|---|---|---|
| G | era designator | (Text) | CE |
| y | year | (Number) | 1996 |
| M | month in year | (Text & Number) | July & 07 |
| d | day in month | (Number) | 10 |
| h | hour in am/pm (1~12) | (Number) | 12 |
| H | hour in day (0~23) | (Number) | 0 |
| m | minute in hour | (Number) | 30 |
| s | second in minute | (Number) | 55 |
| S | millisecond | (Number) | 978 |
| E | day in week | (Text) | Tuesday |
| D | day in year | (Number) | 189 |
| F | day of week in month | (Number) | 2 (2nd Wed in July) |
| w | week in year | (Number) | 27 |
| W | week in month | (Number) | 2 |
| a | am/pm marker | (Text) | PM |
| z | time zone | (Text) | Pacific Standard Time |
| ' | escape for text | (Delimiter) | |
| '' | single quote | (Literal) | ' |
Any non-alphabetic symbols in the pattern are passed on as if these were quoted text.
Compatible with java.text.SimpleDateFormat in Java's standard edition.
| Fields inherited from class net.rim.device.api.i18n.DateFormat |
AM_PM_FIELD, DATE_DEFAULT, DATE_FIELD, DATE_FULL, DATE_LONG, DATE_MEDIUM, DATE_SHORT, DATETIME_DEFAULT, DAY_OF_WEEK_FIELD, ERA_FIELD, GUID_DATE_FORMAT_CHANGED, HOUR_FIELD, HOUR_OF_DAY_FIELD, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, SECOND_FIELD, TIME_DEFAULT, TIME_FULL, TIME_LONG, TIME_MEDIUM, TIME_SHORT, TIMEZONE_FIELD, YEAR_FIELD |
| Constructor Summary | ||
SimpleDateFormat(int style)
Constructs new SimpleDateFormat instance with provided style. |
||
SimpleDateFormat(String pattern)
Constructs a new SimpleDateFormat instance with provided pattern string. |
||
| Method Summary | ||
void |
applyPattern(int style)
Applies a date/time format style to this formatter. |
|
void |
applyPattern(String pattern)
Applies a date/time pattern string to this formatter. |
|
StringBuffer |
format(Calendar calendar,
StringBuffer toAppendTo_o,
FieldPosition pos_io)
Retrieves formatted string representation of calendar object. |
|
int[] |
getFields()
Retrieves ordered list of fields. |
|
String |
toPattern()
Returns a pattern string describing this formatter's current format style. |
|
| Methods inherited from class net.rim.device.api.i18n.DateFormat |
format, formatLocal, formatLocal, getInstance |
| Methods inherited from class net.rim.device.api.i18n.Format |
format |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SimpleDateFormat(int style)
See DateFormat for the date/time format styles you should
choose from.
style - Date/time format style for this formatterpublic SimpleDateFormat(String pattern)
Note: Instead of building a simple date formatter
with this constructor, use DateFormat.getInstance(int) to retrieve the
simple formatter in the particular style you want.
DateFormat| Method Detail |
public void applyPattern(int style)
See DateFormat for the date/time format styles you should
choose from.
style - Date/time format style for this formatter.public void applyPattern(String pattern)
pattern - Pattern string to use with this formatter (see this
class's description for the supported characters in a pattern string).public StringBuffer format(Calendar calendar, StringBuffer toAppendTo_o, FieldPosition pos_io)
This method uses this formatter's current style to format the date contained in your calendar object, placing the result in a string buffer.
format in class DateFormatcalendar - Calendar object containing the date to format.toAppendTo_o - String buffer to hold the formatted results.pos_io - If not null, this method invokes getFields() and
sets the begin/end for the field during formatting.public String toPattern()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.