The JSP page outputs the date format with an El expression

Source: Internet
Author: User

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"%>

2, <fmt:formatdate value= "${project.creatdate}" pattern= "Yyyy-mm-dd"/>

First import the label <% @taglib uri= "http://java.sun.com/jsp/jstl/fmt" prefix= "FMT"%>
<input type= "text" value= "<fmt:formatdate value=" ${viewkq.srq} "pattern=" yyyy-m-d "/>"/>
Value= "${viewkq.srq}" El expression takes a date value pattern: the date format of the output, so that you can format the time

Specific configuration:

<fmt:formatdate value= "${isodate}" type= "both"/> 2018-1-8 23:59:59

<fmt:formatdate value= "${date}" type= "date"/> 2018-1-8

<fmt:formatdate value= "${isodate}" type= "Time"/> 23:59:59

<fmt:formatdate value= "${isodate}" type= "date" datestyle= "Default"/> 2018-1-8

<fmt:formatdate value= "${isodate}" type= "date" datestyle= "short"/> 18-1-8

<fmt:formatdate value= "${isodate}" type= "date" datestyle= "medium"/> 2018-1-8

<fmt:formatdate value= "${isodate}" type= "date" datestyle= "Long"/> January 8, 2018

<fmt:formatdate value= "${isodate}" type= "date" datestyle= "full"/> Monday January 8, 2018

<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"/> Monday, January 8, 2018 13:30:00-060 0

<fmt:formatdate value= "${isodate}" type= "both" pattern= "D MMM yy, h:m:s a zzzz/> 315 months 18, 11:59:59 Noon 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



The JSP page outputs the date format with an El expression

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.