netui
netui:formatDate Tag
A formatter used to format dates.
<netui:formatDate
[country="string_country"]
[language="string_language"]
[pattern="string_pattern"]
[stringInputPattern="string_stringInputPattern"] />
A formatter used to format dates. This formatter uses patterns that conform to
SimpleDateFormat
pattern syntax.
Valid types for formatting are:
- 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="${pageScope.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
|
The number of pattern letters used determines the final presentation. For example,
yy specifies a 2 digit year, while yyyy specifies a four digit year. For detailed information see
SimpleDateFormat
.
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
Attributes |
country |
Required: No | Type:
String |
Supports runtime evaluation / JSP Expression Language: Yes |
Sets the country code for the locale. |
language |
Required: No | Type:
String |
Supports runtime evaluation / JSP Expression Language: Yes |
Sets the language code for the locale. |
pattern |
Required: No | Type:
String |
Supports runtime evaluation / JSP Expression Language: Yes |
Sets the pattern to be used by this format tag.
(See the tag description) |
stringInputPattern |
Required: No | Type:
String |
Supports runtime evaluation / JSP Expression Language: Yes |
The pattern used to convert a String value into a date. |
In this sample, the <netui:span> tag's output will be formatted to something like 08/29/1957.
<netui:span value="${pageScope.today}">
<netui:formatDate pattern="MM/dd/yyyy" />
</netui:span>
Tag Information |
Tag Class | org.apache.beehive.netui.tags.html.FormatDate |
TagExtraInfo Class | None |
Body Content | empty |
Display Name | None |