世界杯logo

VUE 有关date的方法

获取当前时间

let date = new Date();

let year = date.getFullYear();

(因为月份存储的范围是0-11,所以此处要用获取的月份+1)

let month = date.getMonth() + 1;

let day = date.getDate();

星期

let week = date.getDay();

let hours = date.getHours();

let minute = date.getMinutes();

let seconds = date.getSeconds();