直播平台源代码,JavaScript和Python时间戳转换
附JS时间转换:
JS返回date对象的日期部分的本地化字符串 :
new Date().toLocaleDateString()
JS返回date对象的时间部分的本地化字符串
new Date().toLocaleTimeString()
JS接收后端时间戳转为JS时间
new Date(parseInt("后端返回的时间戳"))
PS:
Date对象构造函数参数说名month是返回 0-11 ,因此获取月份需要加一
let now_date = new Date() let now_date_format = `${now_date .getFullYear()}/${now_date .getMonth()+1}/${now_date .getDate()}`
以上就是 直播平台源代码,JavaScript和Python时间戳转换,更多内容欢迎关注之后的文章