首页 > 编程语言 > 详细

Java实现输出此时此刻

时间:2018-05-27 21:59:27      阅读:177      评论:0      收藏:0      [点我收藏+]
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实现输出此时此刻

原文:https://www.cnblogs.com/cj-18/p/9097538.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!