2018-04-01 21:10:12 +08:00
|
|
|
export function getCurrentDay() {
|
2023-04-19 05:20:02 +08:00
|
|
|
const date = new Date();
|
|
|
|
const month = date.getMonth() + 1;
|
|
|
|
const day = date.getDate();
|
2018-04-01 21:10:12 +08:00
|
|
|
|
2023-04-19 05:20:02 +08:00
|
|
|
return `${date.getFullYear()}-${(month > 9 ? '' : '0') + month}-${(day > 9 ? '' : '0') + day}`;
|
2018-04-01 21:10:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function utcTimeStampToLocalTime(timestamp) {
|
2023-04-19 05:20:02 +08:00
|
|
|
const date = new Date(timestamp * 1000);
|
|
|
|
const hours = date.getHours();
|
|
|
|
const mins = date.getMinutes();
|
|
|
|
return `${(hours > 9 ? '' : '0') + hours}:${(mins > 9 ? '' : '0') + mins}`;
|
2018-06-30 12:58:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function formatDateTime(date) {
|
2023-04-19 05:20:02 +08:00
|
|
|
const month = date.getMonth() + 1;
|
|
|
|
const day = date.getDate();
|
|
|
|
const hours = date.getHours();
|
|
|
|
const mins = date.getMinutes();
|
2018-06-30 12:58:11 +08:00
|
|
|
|
2023-04-19 05:20:02 +08:00
|
|
|
return `${date.getFullYear()}-${(month > 9 ? '' : '0') + month}-${(day > 9 ? '' : '0') + day} ${(hours > 9 ? '' : '0') + hours}:${(mins > 9 ? '' : '0') + mins}`;
|
|
|
|
}
|