码迷,mamicode.com
首页 > 其他好文 > 详细

EasyUI时间格式化

时间:2014-11-13 00:22:01      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:io   ar   for   on   cti   ef   时间   as   new   

changeDateFormatNodate: function (cellval) {
var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));

var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
return hour + ":" + minute + ":" + second;
},
//将序列化成json格式后日期(毫秒数)转成日期格式
changeDateFormat: function (cellval) {
var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
return date.getFullYear() + "/" + month + "/" + currentDate + " " + hour + ":" + minute + ":" + second;
},

//将序列化成json格式后日期(毫秒数)转成日期格式
changeDateFormatNoHMS: function (cellval) {
var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));
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;
},

EasyUI时间格式化

标签:io   ar   for   on   cti   ef   时间   as   new   

原文地址:http://www.cnblogs.com/115FXC/p/4093757.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!