The JSP page outputs the date format with an El expression
1, the introduction of labels on the head
<% @ taglib URI = " Http://java.sun.com/jsp/jstl/core " prefix = " C " %> <% @taglib prefix = " FMT " URI = " http://java.sun.com/jsp/jstl/fmt " %>
1. Function:
<value= "${project.creatdate}" pattern= "Yyyy-mm-dd" />
3. Case studies
<Table> <TR> <TD>${data.restaurantname}</TD> <TDrowspan= "3"><imgalt=""width= "The "Height= "The "src= "Http://115.29.201.6/mircroMsg/source-image/speaker.png"></img> </TD> </TR> <TR> <TD><c:ifTest= "${fn:length (data.voucheractivityinfo) <9}"var= "Isshort">${data.voucheractivityinfo}</c:if> <c:ifTest= "${!isshort}">${fn:substring (data.voucheractivityinfo, 0, 6)} ...</c:if></TD> </TR> <TR> <TD><fmt:formatdatevalue= "${data.begintime}"pattern= "yyyy-m-d" />--<fmt:formatdatevalue= "${data.endtime}"pattern= "yyyy-m-d"/>
</ TD > </ TR >
</ Table >
Specific configuration:
<fmt:formatdate value= "${isodate}" type= "both"/>
2004-5-31 23:59:59
<fmt:formatdate value= "${date}" type= "date"/>
2004-4-1
<fmt:formatdate value= "${isodate}" type= "Time"/>
23:59:59
<fmt:formatdate value= "${isodate}" type= "date" datestyle= "Default"/>
2004-5-31
<fmt:formatdate value= "${isodate}" type= "date" datestyle= "short"/>
04-5-31
<fmt:formatdate value= "${isodate}" type= "date" datestyle= "Medium"/>
2004-5-31
<fmt:formatdate value= "${isodate}" type= "date" datestyle= "Long"/>
May 31, 2004
<fmt:formatdate value= "${isodate}" type= "date" datestyle= "full"/>
Monday, May 31, 2004
<fmt:formatdate value= "${isodate}" type= "Time" timestyle= "Default"/>
23:59:59
<fmt:formatdate value= "${isodate}" type= "Time" timestyle= "short"/>
11:59
<fmt:formatdate value= "${isodate}" type= "Time" timestyle= "Medium"/>
23:59:59
<fmt:formatdate value= "${isodate}" type= "Time" timestyle= "Long"/>
11:59 P.M. 59 sec
<fmt:formatdate value= "${isodate}" type= "Time" timestyle= "full"/>
11:59 P.M. 59 sec. CDT
<fmt:formatdate value= "${date}" type= "both" pattern= "eeee, MMMM D, yyyy HH:mm:ss Z"/>
Thursday, April 1, 2004 13:30:00-0600
<fmt:formatdate value= "${isodate}" type= "both" pattern= "D MMM yy, h:m:s a zzzz/>
315 months 04, 11:59:59 PM Central Daylight Time
Format pattern:
A day in the D month. One-digit date has no leading zeros.
DD a day of the month. A one-digit date has a leading zero.
The abbreviated name of the day of the DDD week, defined in Abbreviateddaynames.
dddd the full name of the day of the week, as defined in DayNames.
M-month number. One-digit month has no leading zeros.
MM month number. One-digit month has a leading zero.
Abbreviated name of the MMM month, defined in AbbreviatedMonthNames.
The full name of the MMMM month, as defined in MonthNames.
Y does not contain the year of the era. If the year that does not contain an era is less than 10, the year is displayed without leading zeros.
YY does not contain the year of the era. If the year that does not contain an era is less than 10, the year with leading zeros is displayed.
The YYYY includes the four-digit year of the era.
GG period or ERA. If the date to be formatted does not have an associated period or era string, the pattern is ignored.
H 12 Hour hour system. One-digit hours do not have leading zeros.
HH 12-hour hour. One-digit hours have leading zeros.
H 24 hour hour system. One-digit hours do not have leading zeros.
HH 24-hour hour. One-digit hours have leading zeros.
M minutes. A single-digit number of minutes does not have a leading zero.
MM minutes. A single-digit number of minutes has a leading zero.
s seconds. The number of seconds in a single digit does not have a leading zero.
SS seconds. The number of seconds of one digit has a leading zero.
<fmt:formatdate value= "${xx}" pattern= "dd/mm/yyyy hh:mm aa"/> and
<fmt:formatdate value= "${xx}" pattern= "dd/mm/yyyy hh:mm aa"/> The result is different for 0 point display
- H: Hours, from 1 to 12, minutes in the afternoon range: 01:00 am~12:59am
- H: Hours, range from 0 to 23:00:00 am~23:59am
--2014-05-20 : 14:15