You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
669 B
27 lines
669 B
// 2019年1月22日
|
|
function formatYYMMDDDate(date_str) {
|
|
let date = new Date(Number(date_str) * 1000);
|
|
console.log(date);
|
|
let year = date.getFullYear();
|
|
let month = date.getMonth() + 1;
|
|
let day = date.getDate();
|
|
let hour = date.getHours();
|
|
let minute = date.getMinutes();
|
|
let second = date.getSeconds();
|
|
if (hour < 10) {
|
|
hour = '0' + hour;
|
|
}
|
|
if (minute < 10) {
|
|
minute = '0' + minute;
|
|
}
|
|
if (second < 10) {
|
|
second = '0' + second;
|
|
}
|
|
return `${year}-${month}-${day}` + ` ` + `${hour}:${minute}:${second}`;
|
|
}
|
|
export default {
|
|
data() {
|
|
return {};
|
|
},
|
|
formatYYMMDDDate
|
|
};
|
|
|