The time type output of the JSP page often needs to be formatted, either not the desired format or the page display has such problems, such as: yyyy-mm-dd hh: mm: there is a case with 0 in the SS. In the above cases, two formats of page time output are provided:
1. C: formatting time in foreach
Introduction
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
Use
<FMT: formatdate value = "$ {date}" pattern = "mm DD, yyyy hh: mm: SS"/>
For example:
<C: forEach items = "$ {page. result} "var =" task "> <div class =" $ {task. extend. statusStyle} "> <div class =" $ {task. extend. statusStyle} up "> <div class =" $ {task. extend. statusStyle} upleft "> <span class =" face "> </span> </div> <div class = "$ {task. extend. statusStyle} upright "style =" width: 800px; "> <div class =" title "> <a href =" javascript: showDetail ($ {task. id}) "> $ {Task. title} <span class = "settime"> (<fmt: formatDate value = "$ {task. createDate} "pattern =" yyyy-MM-dd HH: mm: ss "/>) </span> </a> </div> <! -- <Div class = "w270_guanzhu"> <div class = "task_an"> <span onclick = "attent ('$ {task. id} ', '0') "style =" cursor: pointer; "> no longer follow </span> </div> --> </div> <div class =" $ {task. extend. statusStyle} down "> <div class =" $ {task. extend. statusStyle} down_left "> <span> remaining <B >$ {task. extend. surplusDay} </B> day </span> <div class = "bfpix"> <div class = "pix" style = "width :$ {task. finishedRate} px; "> </div> <div class =" pixfont ">$ {task. finishedRate }%</div> <div class = "$ {task. extend. statusStyle} down_right "> <ul> <li style =" border: 0px; "> </li> <p >$ {task. subTaskCount }</p> <span> subtask </span> </li> <p >$ {task. extend. scheduleCount }</p> <span> schedule </span> </li> <p >$ {task. extend. taskLogCount }</p> <span> dynamic </span> </li> <p> 0 </p> <span> document </span> </li> </ul> </div> </c: forEach>
2. Format time in S: iterator:
You do not need to introduce anything separately, for example:
<S: iterator value = "# request. page. result "id =" log "> <div class =" taskinfo_schedule "> <div class =" face left "> <span> </span> </div> <div class = "detail left"> <p> <B> <s: property value = "# log. createName "/> </B>: </p> <em>" </em> <s: property value = "# log. content "/> <em>" </em> <span class = "settime"> (<s: date name = "# log. createDate "format =" yyyy-MM-dd HH: mm: ss "/>) </span> </p> </div> </s: iterator>