js动态获取实时时间
作者:互联网
给大家整理了一点获取当下实时时间的方法:
let curDate = new Date(); //获取对象
let year = curDate.getFullYear(); //获取年
let curMonth = curDate.getMonth() + 1; //获取当前月份(0-11,0代表1月)
let curDay = curDate.getDate(); //获取当前日(1-31)
let curWeekDay = curDate.getDay(); //获取当前星期X(0-6,0代表星期天)
let curHour = curDate.getHours(); //获取当前小时数(0-23)
let curMinute = curDate.getMinutes(); // 获取当前分钟数(0-59)
let curSec = curDate.getSeconds(); //获取当前秒数(0-59)
标签:59,实时,js,获取,let,curDate,当前 来源: https://blog.csdn.net/qq_60961397/article/details/121148815