js时间戳转换成年-月-日

function filerDate(t){
	let toDou=n=>n<10?`0${n}`:`${n}`;
	let oDate=new Date(t);
	return `${oDate.getFullYear()}-${toDou(oDate.getMonth()+1)}-${toDou(oDate.getDate())}`;
}

获取时间戳
 

 Date.parse(new Date())

注意:是否要乘以1000

猜你喜欢

转载自blog.csdn.net/qq_33040483/article/details/83049292