js方法,将时间戳转换为yyyymmddhhmmss格式

来源:互联网 发布:淘宝店铺几天自动收货 编辑:程序博客网 时间:2024/05/17 07:51
var unixTimestamp = new Date( 1477386005*1000 ) ;//获取时间戳commonTime = unixTimestamp.toLocaleString();//转换为yyyymmddhhmmss格式
//具体实现方法
Date.prototype.toLocaleString = function() {          return this.getFullYear() + "年" + (this.getMonth() + 1) + "月" + this.getDate() + "日 " + this.getHours() + "点" + this.getMinutes() + "分" + this.getSeconds() + "秒";    };

原创粉丝点击