All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----com.ibm.as400.ui.framework.java.DataFormatter | +----com.ibm.as400.ui.framework.java.DateFormatter
DataBean
s 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.
DateFormatter
.
DateFormatter
.
Date
object.
public DateFormatter()
DateFormatter
. This constructor
uses the system default style for date display.
public DateFormatter(int style)
DateFormatter
. Accepts a
style to be used for date display.
If the style is not valid, an IllegalArgumentException/code> is thrown.
- Parameters:
- style - a valid
DateFormat
style.
public Object parse(String source) throws IllegalUserDataException
Date
object. All styles are tried for
parsing. If no style succeeds, then an IllegalUserDataException
is
thrown.
public String format(Date date)
Date
object.
public String format(Object obj)
Date
object cast as an object.
public void setStyle(int style)
IllegalArgumentException/code> is thrown.
- Parameters:
- style - a valid
DateFormat
style.
public int getStyle()
DateFormat
style.
All Packages Class Hierarchy This Package Previous Next Index