|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ibm.as400.ui.framework.java.DataFormatter
com.ibm.as400.ui.framework.java.DateFormatter
public class DateFormatter extends DataFormatter
Formatter for exchanging date values between
DataBeans and user interface components.
DateFormatter formats Date objects and displays as dates
according to current locale, and parses date strings into Date objects.
If parsing is unsuccessful, an IllegalUserDataException is thrown.
Dates can be displayed and entered in different styles:
DateFormat.SHORT Shows a numeric convention (e.g. for US locale "11/29/99")
DateFormat.MEDIUM Shows numeric day and year, and abbeviated month. (e.g. for US locale "29-Nov-99")
DateFormat.LONG Same as MEDIUM with non-abbreviated month. (e.g. for US locale "November 29, 1999")
DateFormat.FULL Same as LONG with day of week shown. (e.g. for US locale "Wednesday, November 29, 1999")
DateFormat.DEFAULT system style is also available, which is the style used if no
other style is specified.
The default Locale is used for all formatting and parsing.
Only the date portions of the Date object returned from parsing are meaningful.
DataBean,
IllegalUserDataException,
DateFormat| Constructor and Description |
|---|
DateFormatter()
Constructs a DateFormatter. |
DateFormatter(int style)
Constructs a DateFormatter with the specified style for date display. |
| Modifier and Type | Method and Description |
|---|---|
String |
format(Date date)
Format a date based on the current style set for the Date Formatter. |
String |
format(Object obj)
Format a date based on the current style set for the Date Formatter. |
int |
getStyle()
Gets the style to be used for formatting. |
Object |
parse(String source)
Parses a string to produce a Date object. |
void |
setStyle(int style)
Sets the style to be used for formatting. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DateFormatter()
DateFormatter. This constructor
uses the system default style for date display.
public DateFormatter(int style)
DateFormatter with the specified style for date display.
If the style is not valid, an IllegalArgumentException is thrown.
style - a valid DateFormat style.| Method Detail |
|---|
public Object parse(String source)
throws IllegalUserDataException
Date object. All styles are tried for
parsing. If no style succeeds, then an IllegalUserDataException is
thrown.
parse in class DataFormattersource - the string to be parsedIllegalUserDataExceptionpublic String format(Date date)
date - a valid Date object.public String format(Object obj)
format in class DataFormatterobj - a valid Date object cast as an object.public void setStyle(int style)
IllegalArgumentException is thrown.
style - a valid DateFormat style.public int getStyle()
DateFormat style.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||