700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > js中时间戳转换成xxxx-xx-xx xx:xx:xx类型日期格式的做法

js中时间戳转换成xxxx-xx-xx xx:xx:xx类型日期格式的做法

时间:2019-02-23 23:53:32

相关推荐

js中时间戳转换成xxxx-xx-xx xx:xx:xx类型日期格式的做法

1.十三位数字的时间戳转换方法

var time = new Date(datetime).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");

2.十位数字转换时需要将时间戳乘3使其成为十三位的时间戳;

var time = new Date(datetime*1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");

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