zoukankan      html  css  js  c++  java
  • 09 获取服务器时间

    获取服务器时间:
    var now = new Date($.ajax({async: false}).getResponseHeader("Date"));

    2.new Date()用法:
    获取年:
    var currentYear = now.getFullYear();
    获取月:
    var currentMonth = now.getMonth();
    获取日:
    var currentDay = now.getDate();
    获取小时:
    var currentHours = now.getHours();
    获取分钟:
    var currentMinutes = now.getMinutes();
    获取秒:
    var currentSeconds = now.getSeconds();
    获取毫秒:
    var currentMilliseconds = now.getMilliseconds();
    获取当前日期:
    var currentDate = now.toLocaleDateString();
    获取当前时间:
    var currentTime = now.toLocaleTimeString();
    获取日期和时间:
    var dateTime = now.toLocaleString();
    获取当前星期几:
    var currentWeek = now.getDay();
    获取完成年份:
    var currentFullYear = now.getFullYear();

  • 相关阅读:
    day 06小结
    day 05小结
    day 05作业
    day 04作业
    day 03作业
    今日小结
    day 02小结
    hdu 4608 I-number(13多校#1 ,1009)
    zoj 2316 Matrix Multiplication(D)
    zoj 2316 Matrix Multiplication(2-D)
  • 原文地址:https://www.cnblogs.com/heteng/p/12286386.html
Copyright © 2011-2022 走看看