Compare commits
No commits in common. "01566aa3776bc27c6f2cd67a0d129d2393ea2e1a" and "cc3e5cb0586cf26b8b2d04c61bf21c5b4f288f41" have entirely different histories.
01566aa377
...
cc3e5cb058
|
|
@ -1,14 +0,0 @@
|
|||
//yyyy-MM-dd HH:mm:ss 转 yyyy年MM月dd日HH时mm分
|
||||
|
||||
export function formatDate(date, format = "yyyy年MM月dd日HH时mm分") {
|
||||
if (!date) {
|
||||
return "";
|
||||
}
|
||||
const dateObj = new Date(date);
|
||||
const year = dateObj.getFullYear();
|
||||
const month = dateObj.getMonth() + 1;
|
||||
const day = dateObj.getDate();
|
||||
const hour = dateObj.getHours();
|
||||
const minute = dateObj.getMinutes();
|
||||
return format.replace("yyyy", year).replace("MM", month).replace("dd", day).replace("HH", hour).replace("mm", minute);
|
||||
}
|
||||
Loading…
Reference in New Issue