|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.i18n.Format
net.rim.device.api.i18n.DateFormat
public abstract class DateFormat
Defines fundamental functionality for locale-independent formatting of date/time information.
Compatible with java.text.DateFormat from Java's standard edition.
Note: Time and date interpretation is consistent with
Calendar objects. For example, the exact moment of "midnight" always
belongs to the following day.
| Field Summary | ||
|---|---|---|
static int |
AM_PM_FIELD
Useful constant for AM_PM field alignment. |
|
static int |
DATETIME_DEFAULT
Default date-time format style. |
|
static int |
DATE_DEFAULT
Default date format style. |
|
static int |
DATE_FIELD
Useful constant for DATE field alignment. |
|
static int |
DATE_FULL
Full date style. |
|
static int |
DATE_LONG
Long date style. |
|
static int |
DATE_MEDIUM
Medium date style. |
|
static int |
DATE_SHORT
Short date style. |
|
static int |
DAY_OF_WEEK_FIELD
Useful constant for DAY_OF_WEEK field alignment. |
|
static int |
ERA_FIELD
Useful constant for ERA field alignment. |
|
static long |
GUID_DATE_FORMAT_CHANGED
GUID for the global event sent when the default date format changes. |
|
static int |
HOUR_FIELD
Useful constant for HOUR field alignment. |
|
static int |
HOUR_OF_DAY_FIELD
Useful constant for HOUR_OF_DAY field alignment. |
|
static int |
MILLISECOND_FIELD
Useful constant for MILLISECOND field alignment. |
|
static int |
MINUTE_FIELD
Useful constant for MINUTE field alignment. |
|
static int |
MONTH_FIELD
Useful constant for MONTH field alignment. |
|
static int |
SECOND_FIELD
Useful constant for SECOND field alignment. |
|
static int |
TIMEZONE_FIELD
Useful constant for TIMEZONE field alignment. |
|
static int |
TIME_DEFAULT
Default time format style. |
|
static int |
TIME_FULL
Full time style. |
|
static int |
TIME_LONG
Long time style. |
|
static int |
TIME_MEDIUM
Medium time style: typically, this style should be used by default. |
|
static int |
TIME_SHORT
Short time style. |
|
static int |
YEAR_FIELD
Useful constant for YEAR field alignment. |
|
| Constructor Summary | ||
|---|---|---|
protected |
DateFormat()
Constructs new DateFormat instance. |
|
| Method Summary | ||
|---|---|---|
StringBuffer |
format(Object obj,
StringBuffer toAppendTo_o,
FieldPosition pos_io)
Retrieves formatted string representation of object. |
|
abstract StringBuffer |
format(Calendar date,
StringBuffer toAppendTo_o,
FieldPosition pos_io)
Retrieves formatted string representation of calendar object. |
|
StringBuffer |
formatLocal(StringBuffer sb,
long date)
Retrieves formatted representation of local date into string buffer. |
|
String |
formatLocal(long date)
Retrieves formatted representation of local date. |
|
static DateFormat |
getInstance(int style)
Retrieves the date formatter for the given style and the default locale. |
|
| Methods inherited from class net.rim.device.api.i18n.Format |
|---|
format, getFields |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long GUID_DATE_FORMAT_CHANGED
public static final int DATE_FULL
All date information should be present, including era and timezone.
public static final int DATE_LONG
For example: Wednesday, March 08, 2006.
public static final int DATE_MEDIUM
Typically, this style should be used by default.
public static final int DATE_SHORT
A very abbreviated format; for example, may include only numbers for date, month, and year.
public static final int DATE_DEFAULT
By default, set to DateFormat.DATE_MEDIUM; subclasses may override this.
public static final int TIME_FULL
All time information should be present, including era and timezone.
public static final int TIME_LONG
public static final int TIME_MEDIUM
public static final int TIME_SHORT
A very abbreviated format; for example, time might not include anything except hour.
public static final int TIME_DEFAULT
By default, set to DateFormat.TIME_MEDIUM; subclasses may override this.
public static final int DATETIME_DEFAULT
By default, set to (DateFormat.DATE_DEFAULT | DateFormat.TIME_DEFAULT);
subclasses may override this.
public static final int MILLISECOND_FIELD
By default, equal to Calendar.MILLISECOND.
public static final int SECOND_FIELD
By default, equal to Calendar.SECOND.
public static final int MINUTE_FIELD
By default, equal to Calendar.MINUTE.
public static final int HOUR_FIELD
By default, equal to Calendar.HOUR.
public static final int HOUR_OF_DAY_FIELD
By default, equal to Calendar.HOUR_OF_DAY.
public static final int AM_PM_FIELD
By default, equal to Calendar.AM_PM.
public static final int DATE_FIELD
By default, equal to Calendar.DAY_OF_MONTH.
public static final int MONTH_FIELD
By default, equal to Calendar.MONTH.
public static final int YEAR_FIELD
By default, equal to Calendar.YEAR.
public static final int ERA_FIELD
By default, equal to CalendarExtensions.ERA.
public static final int DAY_OF_WEEK_FIELD
By default, equal to Calendar.DAY_OF_WEEK.
public static final int TIMEZONE_FIELD
By default, set to "90" (no equivalent in Calendar).
| Constructor Detail |
|---|
protected DateFormat()
| Method Detail |
|---|
public abstract StringBuffer format(Calendar date,
StringBuffer toAppendTo_o,
FieldPosition pos_io)
Comparable to java.text.DateFormat.format in Java's standard edition.
date - Calendar object containing date to format.toAppendTo_o - String buffer to hold the formatted results.pos_io - If not null, this method should invoke Format.getFields()
and set the begin/end for this field during formatting.
public StringBuffer format(Object obj,
StringBuffer toAppendTo_o,
FieldPosition pos_io)
Comparable to java.text.DateFormat.format in Java's standard edition.
Note: This method casts the provided object to a
Calendar, and invokes DateFormat.format(Calendar,StringBuffer,FieldPosition).
format in class Formatobj - Object to format.toAppendTo_o - String buffer to hold the formatted results.pos_io - If not null, this method should invoke Format.getFields()
and set the begin/end for this field during formatting.
public static final DateFormat getInstance(int style)
style - Date/time format style to use (one of
DateFormat.DATE_FULL,
DateFormat.DATE_LONG,
DateFormat.DATE_MEDIUM,
DateFormat.DATE_SHORT,
DateFormat.DATE_DEFAULT,
DateFormat.TIME_FULL,
DateFormat.TIME_LONG,
DateFormat.TIME_MEDIUM,
DateFormat.TIME_SHORT,
DateFormat.TIME_DEFAULT,
DateFormat.DATETIME_DEFAULT).
SimpleDateFormat instance with the provided style.
public final StringBuffer formatLocal(StringBuffer sb,
long date)
sb - String buffer to hold the formatted results.date - Date/time to format.
public final String formatLocal(long date)
date - Date/time to format.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal