import moment from './moment.js';
export function getDateString(dateType, date) {
//return moment(date,"YYYY/MM/DD").format('YYYY/MM/DD');
switch (dateType) {
case 1:
return moment(date, "YYYY/MM/DD HH:mm:ss").format('YYYY-MM-DD HH:mm');
case 2:
return moment(date, "YYYY/MM/DD HH:mm:ss").format('YYYY-MM-DD HH:mm:ss');
case 3:
return moment(date, "YYYY/MM/DD").format('YYYY年MM月DD日');
case 4:
{
date = addDays(date, -1);
return `${moment(date,"YYYY/MM/DD").format('YYYY年')}-${getYearWeek(date)}周`;
}
case 6:
return moment(date, "YYYY/MM/DD").format('YYYY年MM月');
case 7:
return moment(date, "YYYY/MM/DD").format('MM-DD');
case 8:
return moment(date, "YYYY/MM/DD").format('MM月DD日');
case 9:
return moment(date, "YYYY/MM/DD").format('YYYY年');
case 10:
return moment(date, "YYYY/MM/DD").format('YYYY');
}
}
记录下moment.js格式化日期
最新推荐文章于 2023-08-22 11:02:52 发布