A formatter used to format dates.
<netui:formatDate
[country="string_country"]
[language="string_language"]
[pattern="string_simpleDataFormat"]
[stringInputPattern="string_stringInputPattern"] />
- String
- java.sql.Date
- java.util.Date
- java.util.Calendar
The <netui:formatDate> tag formats the output of its parent tag. For example:
<netui:content value="{pageContext.euroDate}"> <netui:formatDate pattern="dd-MM-yyyy" /> </netui:content>
The following table summarizes the pattern letters that can be used.
Letter | Date or Time Component | Examples |
---|---|---|
G
| Era designator | AD
|
y
| Year | 1996 ; 96
|
M
| Month in year | July ; Jul ; 07
|
w
| Week in year | 27
|
W
| Week in month | 2
|
D
| Day in year | 189
|
d
| Day in month | 10
|
F
| Day of week in month | 2
|
E
| Day in week | Tuesday ; Tue
|
a
| Am/pm marker | PM
|
H
| Hour in day (0-23) | 0
|
k
| Hour in day (1-24) | 24
|
K
| Hour in am/pm (0-11) | 0
|
h
| Hour in am/pm (1-12) | 12
|
m
| Minute in hour | 30
|
s
| Second in minute | 55
|
S
| Millisecond | 978
|
z
| Time zone | Pacific Standard Time ; PST ; GMT-08:00
|
Z
| Time zone | -0800
|
If the input type is a String, <netui:formatDate> attempts to convert the String into a java.util.Date object before formatting. For the conversion to succeed, the String must conform to a format listed below.
The valid formats are:
- MM/dd/yy
- yyyy-MM-dd
- MMddyy
- the local default
country | Determines a formatting style for the specified country.
The country attribute takes an uppercase,
two letter code as defined by ISO-3166.
For a list of country codes see
ISO-3166 Country Codes |
||||||
|
|||||||
|
|||||||
language | Determines a formatting style for the specified language.
The language
attribute is optional, but it must be set when the country attribute is set.
The language attribute takes a lowercase,
two letter code as defined by ISO-639.
For a list of language codes see
ISO-639 Language Codes |
||||||
|
|||||||
|
|||||||
pattern |
The pattern used to format the input.
For detailed information on pattern syntax see java.text.DecimalFormat . |
||||||
|
|||||||
|
|||||||
stringInputPattern | The pattern used to convert a String value into a date. | ||||||
|
|||||||
|
<netui:label value="{pageContext.today}"> <netui:formatDate pattern="MM/dd/yyyy" /> </netui:label>