标签:时间 style class highlight htm blank pwd rda orm
<script type="text/javascript">
function dateToGMT(strDate) {
if(null==strDate || ""==strDate){
return "";
}
var dateStr=strDate.trim().split(" ");
var strGMT = dateStr[0]+" "+dateStr[1]+" "+dateStr[2]+" "+dateStr[5]+" "+dateStr[3]+" GMT+0800";
var date = new Date(Date.parse(strGMT));
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? (‘0‘ + m) : m;
var d = date.getDate();
d = d < 10 ? (‘0‘ + d) : d;
var h = date.getHours();
var minute = date.getMinutes();
minute = minute < 10 ? (‘0‘ + minute) : minute;
var second = date.getSeconds();
second = second < 10 ? (‘0‘ + second) : second;
return y+"-"+m+"-"+d+" "+h+":"+minute+":"+second;
}
function time(id, strDate){
document.getElementById(id).innerHTML = dateToGMT(strDate);
}
</script>
<c:set var = "i" value = "0"/>
<c:forEach items="${requestScope.sppurchases}" var="spp"
varStatus="stat">
<tr class="cart_item">
<td class="product-price"><span class="amount">${spp.dingdanid}</span></td>
<td class="product-name"><a href="${pwd }/goods/detial?id=${spp.gid}">${requestScope.name[i]}</a></td>
<td class="product-price"><span class="amount">${spp.num}</span></td>
<td class="product-price"><span class="amount">${spp.money}</span></td>
<td class="product-price"><span class="amount" id = ${spp.id } >${spp.purtime}
<script type="text/javascript">time( "${spp.id }" , "${spp.purtime}")</script>
</span></td>
</tr>
<c:set var = "i" value = "${i + 1}"/>
</c:forEach>
标签:时间 style class highlight htm blank pwd rda orm
原文地址:https://www.cnblogs.com/zhumengdexiaobai/p/10253765.html