1234567891011121314151617 |
- export function dateFormmat(date) {
- const T = date ? new Date(date) : new Date();
- const P = {
- year: T.getFullYear(),
- month: T.getMonth() - 0 + 1,
- day: T.getDate(),
- hour: T.getHours(),
- min: T.getMinutes(),
- s: T.getSeconds()
- }
- P.month > 9 ? P.month = P.month : P.month = "0" + P.month;
- P.day > 9 ? P.day = P.day : P.day = "0" + P.day;
- P.hour > 9 ? P.hour = P.hour : P.hour = "0" + P.hour;
- P.min > 9 ? P.min = P.min : P.min = "0" + P.min;
- P.s > 9 ? P.s = P.s : P.s = "0" + P.s;
- return P
- }
|