function getMyDateTime(str){
var oDate = new Date(str),
oYear = oDate.getFullYear(),
oMonth = oDate.getMonth()+1< 10 ? "0" + (oDate.getMonth()+1) : (oDate.getMonth()+1);
oDay = oDate.getDate()< 10 ? "0" + oDate.getDate() : oDate.getDate();
oHour = oDate.getHours() < 10 ? "0" + oDate.getHours() : oDate.getHours();
oMinute = oDate.getMinutes() < 10 ? "0" + oDate.getMinutes() : oDate.getMinutes();
oSecond = oDate.getSeconds() < 10 ? "0" + oDate.getSeconds() : oDate.getSeconds();

oTime = oYear +'-'+ oMonth +'-'+ oDay +" "+ oHour + ":" + oMinute + ":" +oSecond;//最后拼接时间
return oTime;
};

posted on 2019-04-29 15:28  慕筱优  阅读(1545)  评论(0编辑  收藏  举报