JS 日期时间毫秒值转化成时间,并且分钟显示2位。


Date.prototype.toLocaleString = function() {

var M= this.getMinutes();//获取

  M=M>9?M:"0"+M; //如果分钟小于10,则在前面加0补充为两位数字
    return this.getFullYear() + "年" + (this.getMonth() + 1) + "月" + this.getDate() + "日 " + this.getHours() + ":" + M  ;
};
var ttime=new Date(dt.activityTime ).toLocaleString().replace(/:\d{1,2}$/,' ');


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM