700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > js格式化时间和js格式化时间戳示例

js格式化时间和js格式化时间戳示例

时间:2022-02-06 06:47:48

相关推荐

js格式化时间和js格式化时间戳示例

web前端|js教程

格式化时间,js格式化时间戳,格式化日期

web前端-js教程

佛网站源码,ubuntu 怎么跳过登录,tomcat数据库怎么打开,空解决爬虫问题,php如何给网站添加后门,seo关注数据lzw

/**

* 时间对象的格式化;

*/

Date.prototype.format = function(format) {

/*

* eg:format="YYYY-MM-dd hh:mm:ss";

*/

var o = {

"M+" :this.getMonth() + 1, // month

"d+" :this.getDate(), // day

"h+" :this.getHours(), // hour

"m+" :this.getMinutes(), // minute

"s+" :this.getSeconds(), // second

"q+" :Math.floor((this.getMonth() + 3) / 3), // quarter

"S" :this.getMilliseconds()

// millisecond

}

if (/(y+)/.test(format)) {

format = format.replace(RegExp.$1, (this.getFullYear() + "")

.substr(4 - RegExp.$1.length));

}

for ( var k in o) {

if (new RegExp("(" + k + ")").test(format)) {

format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k]

: ("00" + o[k]).substr(("" + o[k]).length));

}

}

return format;

}

粉丝宝源码,ubuntu装系统grub,tomcat入门教程第13讲,爬虫后显示乱码,宝塔面板安装PHP后不显示,青岛seo行业lzw

var now = new Date().format("yyyy-MM-dd hh:mm:ss");

logo设计网源码,ant的ubuntu安装,蜥蜴爬虫类,php前段,seo团队kpilzw

new Date().format("yy-MM-dd hh:mm");

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。