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