1. 程式人生 > >Java實現輸出此時此刻

Java實現輸出此時此刻

cti IV new pre col minutes nth color etsec

function date() {
    let weekday = [];
    weekday[0] = "周日";
    weekday[1] = "周一";
    weekday[2] = "周二";
    weekday[3] = "周三";
    weekday[4] = "周四";
    weekday[5] = "周五";
    weekday[6] = "周六";
    let date = new Date();
    let year = date.getFullYear();
    let month = date.getMonth() + 1;
    let day 
= date.getDate(); let hours = date.getHours(); let minute = date.getMinutes(); let second = date.getSeconds(); let week = weekday[date.getDay()]; console.log(`${year}年${month}月${day}日,${week},${hours}時${minute}分${second}秒`); } date();

Java實現輸出此時此刻