通用javascript方法
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
//将序列化成json格式后日期(毫秒数)转成日期格式 YYYY-MM-DD HH:MI:SS function ChangeDateFormat(cellval, type) { var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10)); var year = date.getFullYear(); var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); var min = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); var sec = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); var result; switch (type) { case "0": result = year + "-" + month + "-" + day; break; case "1": result = hours + ":" + min + ":" + sec; break; case "2": result = year + "-" + month + "-" + day + " " + hours + ":" + min + ":" + sec; break; case "3": result = hours + ":" + min; break; default: "不符合格式" }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; }
得即高歌失即休,多愁多恨亦悠悠。今朝有酒今朝醉,明日愁来明日愁