joson返回数据库的时间格式在前台用js转换
2024-08-28 02:56:27
function ChangeDateFormat(val) {
if (val != null) {
var date = new Date(parseInt(val.replace("/Date(", "").replace(")/", ""), 10));
//月份为0-11,所以+1,月份小于10时补个0
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) :
date.getMonth() + 1;
var currentDate = date.getDate() < 10 ? "0" + date.getDate() :
date.getDate();
return date.getFullYear() + "-" + month + "-" + currentDate;
}
return "";
}
最新文章
- 如何优化coding
- 用H5中的Canvas等技术制作海报
- 获取exr图片上像素点的颜色通道
- android帧动画,移动位置,缩放,改变透明度等动画讲解
- BZOJ 3223: Tyvj 1729 文艺平衡树
- sdk墙内更新方法
- POJ1942 Paths on a Grid(组合)
- 将HTML格式的String转化为HTMLElement
- .net mvc下的Areas和小写Url
- NIPS 2016论文:英特尔中国研究院在神经网络压缩算法上的最新成果
- FFPLAY的原理(六)
- [Swift]LeetCode492. 构造矩形 | Construct the Rectangle
- flask你一定要知道的上下文管理机制
- POJ 3280 - Cheapest Palindrome - [区间DP]
- selenium webdriver窗口切换(上)
- thymeleaf 标签使用方法
- WeX5入门之欢乐捕鱼打包
- InputStream中mark方法使用
- SpringBoot 获取前端页面参数的集中方式总结
- PDF通过剪裁来实现打印字体变大