写一个转换时间格式的公用方法:
将'2019-5-6 16:30:02’ 转换成 2019年05月06日 16时30分02秒
~function(pro){ pro.formatTime=function(template){ template=template || '{0}年{1}月{2}日 {3}时{4}分{5}秒'; var ary=this.match(/d+/g); template=template.replace(/{(d+)}/g,function (){ var n=arguments[1], val=ary[n] || '0'; val<10?val= '0'+val:null; return val; }); return template; } }(String.prototype) var str='2019-5-6 16:30:02; str.formatTime();//2019年05月06日 16时30分02秒
转载于:https://www.cnblogs.com/xinxinxiangrong7/p/11432220.html
最后
以上就是眼睛大牛排最近收集整理的关于转换时间格式的方法的全部内容,更多相关转换时间格式内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复