将中国标准时间转换为yy-MM-dd

将中国标准时间转换为yy-MM-dd

js代码

let time=new Date(new Date());
var datetime=time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate() + ' ' + time.getHours() + ':' + time.getMinutes() + ':' + time.getSeconds();
				
console.log(time);
console.log(datetime);

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_42583263/article/details/115079499
今日推荐