const formatDate = ( time: any ) => {// 格式化日期
const Dates = new Date( time );
const year: number = Dates.getFullYear();
const month: any = ( Dates.getMonth() + 1 ) < 10 ? '0' + ( Dates.getMonth() + 1 ) : ( Dates.getMonth() + 1 );
const day: any = Dates.getDate() < 10 ? '0' + Dates.getDate() : Dates.getDate();
return year + '-' + month + '-' + day;
};
this.startTime = formatDate( new Date().getTime() );
typescript 格式化日期 new Date().getTime()
最新推荐文章于 2024-04-25 00:24:56 发布