Math.floor(Math.random()*10);//产生10以内的随机数

new Date(); //获取当前时间(字符串类型)

new Date().getTime(); //获取当前的毫秒数

new Date(1356334057000) ;//通过毫秒数创建时间

new Date().getMonth()+1; //获取月份,从0开始,所以要加上1

new Date().getFullYear(); //获取年份

new Date().getDay()+1;//获取当前是星期X,从0开始

new Date().getDate());//获取日

new Date().getHours()//获取小时

new Date().getMinutes()//获取分钟

new Date().getSeconds()//获取秒

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2021-09-19
  • 2022-02-25
  • 2022-12-23
  • 2021-07-01
  • 2021-11-28
猜你喜欢
  • 2021-07-12
  • 2022-12-23
  • 2022-03-08
  • 2022-12-23
  • 2022-01-26
  • 2021-11-27
  • 2021-09-19
相关资源
相似解决方案