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為獲取到后台傳來的時間戳。