1.字符类型间接转化:20171130082510格式成2017-11-30
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<td class="c">
<c:set var="approvalTimeVar" value="20171130082510" />
<fmt:parseDate value="${approvalTimeVar}" var="approvalTimeDate" pattern="yyyyMMddHHmmss" />
<fmt:formatDate value="${approvalTimeDate}" type="both" pattern="yyyy-MM-dd"/>
</td>
2.日期类型直接转化:20171130082510格式成2017-11-30
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:formatDate value="20171130082510" type="date"dateStyle="short"/>
3.参考网址:
- fmt:parseDate详解:http://blog.csdn.net/kpchen_0508/article/details/41250957
- fmt:parseDate和fmt:formatDate比较:http://blog.csdn.net/zzj806683450/article/details/37902639
网友评论