Summary
Tag name:
<
af:convertDateTime
>
Converts string into java.util.Date and vice versa based on the pattern
and style set.
New dateStyle
shortish
has been introduced.
Shortish is identical to
short
but forces the year to be
a full four digits. dateStyle defaults to
shortish
if it was not set.
Timezone can be set per web-app in adf-faces-config.xml configuration file.
If timeZone is not set on the converter, then timezone will be defaulted to the
value set in adf-faces-config.xml configuration file. If it is not set in the
configuration file, then it will be defaulted to GMT.
The converter always allows a level of leniency while converting
user input value to date to the following extent.
-
A converter with associated pattern 'MMM' for month, when attached to any
value holder, will accept values with month specified in the form 'MM' or 'M'
as valid.
-
Allows use of separators '-' or '.' or '/' irrespective of the separator
specified in the associated pattern.
-
The leniency is applicable to both 'pattern' and 'secondaryPattern'.
For example:
When pattern on the converter is set to "MMM/d/yyyy" the following inputs
are tolerated as valid by the converter.
-
Jan/4/2004
-
Jan-4-2004
-
Jan.4.2004
-
01/4/2004
-
01-4-2004
-
01.4.2004
-
1/4/2004
-
1-4-2004
-
1.4.2004
This converter is automatically registered under the standard
converter ID, and therefore will be used w
hen the
<
f:convertDateTime
>
tag is used.
Example:
<af:inputText id="mdf5" value="2004/09/06"
label="Date">
<af:convertDateTime pattern="yyyy/M/d" secondaryPattern="d/M/yyyy" />
</af:inputText>
Attributes
|
Name
|
Type
|
Supports EL?
|
Description
|
|
convertBothMessageDetail
|
String
|
Yes
|
Custom error message to be used, for creating detail part of
faces message, for date-time based value that cannot be converted
to date when
type
is set to
'both'
and
pattern
is not set or is null.
Parameters:
-
{0} the label that identifies the component
-
{1} value entered by the user
-
{2} an example of the format the converter is expecting
|
|
convertDateMessageDetail
|
String
|
Yes
|
Custom error message to be used, for creating detail part of
faces message, for values that cannot be converted to date when
the pattern / secondary pattern is set or when
type
is set to
'date'
and
pattern
is not set or is null.
Parameters:
-
{0} the label that identifies the component
-
{1} value entered by the user
-
{2} an example of the format the converter is expecting
|
|
convertTimeMessageDetail
|
String
|
Yes
|
Custom error message to be used, for creating detail part of
faces message, for time based value that cannot be converted
to date when
type
is set to
'time'
,
pattern
is
not set or is null
Parameters:
-
{0} the label that identifies the component
-
{1} value entered by the user
-
{2} an example of the format the converter is expecting
|
|
dateStyle
|
String
|
Yes
|
Predefined formatting style which determines how the date component
of a date string is to be formatted and parsed. Applied only if type
is "date" or "both". Valid values are "shortish", "short", "default",
"medium", "long", and "full". Default value is "shortish".
|
|
locale
|
java.util.Locale
|
Yes
|
Locale whose predefined styles for dates and times are used during
formatting or parsing. If not specified or if null, the Locale returned by
FacesContext.getViewRoot().getLocale() will be used.
|
|
pattern
|
String
|
Yes
|
Custom formatting pattern which determines how the date/time string
should be formatted and parsed.
|
|
secondaryPattern
|
String
|
Yes
|
Second pattern, which will be used as a second attempt to parse a
string if the primary pattern or styles fail, but is never used for
formatting strings.
|
|
timeStyle
|
String
|
Yes
|
Predefined formatting style which determines how the time component of
a date string is to
be formatted and parsed. Applied only if type is
"time" or "both". Valid values are "default", "short", "medium",
"long", and "full". Default value is "short".
|
|
timeZone
|
java.util.TimeZone
|
Yes
|
Time zone in which to interpret any time information in the date
string. If not set here, picks this value from
adf-faces-config.xml configuration file. If not defined there, then
it is defaulted to GMT.
|
|
type
|
String
|
Yes
|
Specifies what contents the string value will be formatted to
include, or parsed. Valid values are "date", "time", and "both".
Default value is "date".
|