草庐IT

prefixZero

全部标签

JS 对时间日期的转换与操作

JS时间格式转换this.timeFormatConvert(newDate())// 2022-11-2621:37:29/**时间格式转换*@parame要转换的日期(如:SatNov26202221:37:29GMT+0800(中国标准时间))*@returns{string}转换结果(如:2022-11-2621:37:29)*/timeFormatConvert(e){constY=e.getFullYear();//年constM=this.prefixZero(e.getMonth()+1);//月constD=this.prefixZero(e.getDate());//日co