1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| const getWeekDate = () => { const date = new Date() const month = date.getMonth() + 1; const day = date.getDate();
const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; const weekday = weekdays[date.getDay()];
const hours = date.getHours(); const minutes = date.getMinutes();
const formattedDate = `${month}/${day}`; const formattedTime = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`;
return `${formattedDate} ${weekday} ${formattedTime}`; }
|