function timeNow(){
    var date = new Date();
    this.year = date.getFullYear();
    this.month = date.getMonth() + 1;
    this.date = date.getDate();
    this.day = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")[date.getDay()];
    this.hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    this.minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    this.second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    var currentTime = this.year + "年" + this.month + "月" + this.date + "日 " + this.hour + ":" + this.minute + ":" + this.second + " " + this.day;
    $('.timeRight').text(currentTime);//在页面标签中写入时期
    console.log(currentTime);
}
timeNow()

获取当前的时间。

相关文章:

  • 2021-08-07
  • 2022-02-25
  • 2021-11-17
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
相关资源
相似解决方案