

網上有的說是需要在實體上加注解
我這里在jsp頁面解決的


代碼如下 :
function timestampToTime(timestamp) {
if(timestamp == '' || timestamp == null || typeof(timestamp) == "undefined"){
return "";
}
var date = new Date(timestamp);//時間戳為10位需*1000,時間戳為13位的話不需乘1000
var date = new Date(timestamp*1000);
Y = date.getFullYear() + '-';
M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
D = date.getDate() + ' ';
h = date.getHours() + ':';
m = date.getMinutes() + ':';
s = date.getSeconds();
return Y+M+D+h+m+s;
}
去掉頁面顯示時間時 時 分 秒 為0 2020-03-03 00:00:00
<tr height="30px;" >
<td class="td_head" nowrap width="30%">組織機構代碼有效期</td>
<td class="td_body" nowrap id="insTerm">
${strPolicy.strInsured.insTerm}
</td>
</tr>
//將日期后邊的0去掉
var insTerm = $("#insTerm").html();
insTerm = insTerm.replace("00:00:00.0","");
$("#insTerm").html(insTerm);
也可以
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:formatDate value="${xxxxx.plcyBndTime}" pattern="yyyy-MM-dd HH:mm:ss" />
<fmt:formatDate value="${xxxxx.plcyBndTime}" pattern="yyyy-MM-dd " />
