首页 > 编程知识 正文

sqlserver时间转换为字符串,时间格式转换为时间戳

时间:2023-05-04 02:15:20 阅读:220346 作者:2061

GMTToStr(time){ // 将 GMT格式的时间字符串 格式化为正常时间字符串 let date = new Date(time) let Str=date.getFullYear() + '/' + (this.handleTimeStr(date.getMonth() + 1)) + '/' + this.handleTimeStr(date.getDate()) + ' ' + this.handleTimeStr(date.getHours()) + ':' + this.handleTimeStr(date.getMinutes()) + ':' + this.handleTimeStr(date.getSeconds()) return Str},handleTimeStr(tStr){ // 解决 10:2:2 出现各位数字格式化为 10:02:02 if (tStr < 10){ return '0'+ tStr }else { return tStr }},在这里插入代码片

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。