//获取当前的日期时间函数,格式为“yyyy-MM-dd hh:mm:ss” function getNowFormatDate(date) { if (date == null) { var date = new Date(); } var seperator1 = "-"; var seperator2 = ":"; var month = date.getMonth() + 1; if (month >= 1 && month <=
/** * Created by Administrator on 2019/11/15. *指尖敲打着世界 ----一个阳光而又不失帅气的少年!!!. */ // js获取当前时间,并格式化为"yyyy-MM-dd HH:mm:ss" function getFormatDate() { var date = new Date(); var month = date.getMonth() + 1; var strDate = date.getDate(); if (month >
Date 对象,是操作日期和时间的对象. Date 为内置的构造函数, 通过 new Date () 来获取当前本地日期与时间 const time = new Date console.log(time )//Mon Nov 05 2018 15:20:49 GMT+0800 传参 传递Number 将从 '1970/01/01 00:00:00' 为起点,开始叠加的毫秒数,传入负值将倒退. time(1000)//Thu Jan 01 1970 08:00:01 GMT+0800 (中国