900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > js时间戳转换成日期格式

js时间戳转换成日期格式

时间:2023-08-27 19:42:30

相关推荐

js时间戳转换成日期格式

//时间戳转日期格式function timestampToTime(timestamp) {var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000Y = date.getFullYear() + '-';M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';D = date.getDate() + ' ';h = date.getHours() + ':';m = date.getMinutes() + ':';s = date.getSeconds();return Y + M + D + h + m + s;}

微信小程序开发交流qq群 173683895

承接微信小程序开发。扫码加微信。

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