一、获取当前日期和时间
实现效果(没加样式)
1:准备好要获取时间的.js文件中加载util.js文件,文件目录中有默认的代码
util.js
const formatTime =date=>{
const year= date.getFullYear()
const month=date.getMonth()+1
const day=date.getDate()
const hour=date.getHours()
const minute=date.getMinutes()
const second = date.getSeconds()
return [year,month,day].map(formatNumber).join('/&#