回顾JS Date()对象

突然想写一个日历插件发现Date对象的一些常识快忘光了,复习一下

  • new Date()返回当前时间 年月日
  • getFullYear() 返回年份
  • getMonth() 返回月份(因为从0开始算 所以要+1)
  • getDay() 返回星期几
  • getDate() 返回日期
  • new Date(2017,0,8)传入参数的情况下 代表2017/1/8 月份是从0开始算的
  • new Date(2017,0,0) 返回上一个月最后一天
原文地址:https://www.cnblogs.com/shigongzi/p/7172981.html