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.TimeFormatter
DataBean
s and user interface components.
TimeFormatter
formats Date
objects and displays as times
according to current locale, and parses time strings into Date
objects.
If parsing is unsuccessful, an IllegalUserDataException
is thrown.
Times can be displayed and entered in different styles:
DateFormat.SHORT
Shows hours and minutes (e.g. for US locale "3:06 PM")
DateFormat.MEDIUM
Shows hours, minutes and seconds (e.g. for US locale "3:06:59 PM")
DateFormat.LONG
Shows hours, minutes, seconds, and time zone (e.g. for US locale "3:06:59 PM CDT")
DateFormat.FULL
Same as LONG with words. (e.g. for US locale "3:06:59 o'clock PM CDT")
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 time portions of the Date
object returned from parsing are meaningful.
TimeFormatter
.
TimeFormatter
.
Date
object.
public TimeFormatter()
TimeFormatter
. This constructor
uses the system default style for time display.
public TimeFormatter(int style)
TimeFormatter
. Accepts a
style to be used for time 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