web前端时间戳转时间类型显示

1、jsp头部加:<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

2、例子:<td><fmt:formatDate value="${product.createDate  }" pattern="yyyy-MM-dd"/></td>,product.createDate为时间戳格式。

3、js中转换:new Date(temp.createDate).toLocaleString().substring(0, 10).replace(/年|月|//g, "-"),emp.createDate为获取到后台传来的时间戳。

原文地址:https://www.cnblogs.com/paulen/p/8134657.html