Yes the JSTL formatDate
tag should do the job in combination with changing the Timestamp value into a date object (which is required to work around the exception mentioned in your comment).
Ensure that you have properly defined the fmt
prefix in the JSP declarations
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
Render the output, convert the time stamp to a date value first. I'm using yyyy-MM-dd
as the format pattern, the dateFormat
tag supports other formatting options as well.
<cms:contentaccess var="newsitem" />
<jsp:useBean id="newsDate" class="java.util.Date" />
<jsp:setProperty name="newsDate" property="time" value="${newsitem.value['Date']}" />
<h2><c:out value="${newsitem.value['Title']}" /></h2>
<fmt:formatDate pattern="yyyy-MM-dd" value="${newsDate}" />
<c:out value="${newsitem.value['Text']}" escapeXml="false" />
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…