zoukankan      html  css  js  c++  java
  • JS工具对象 DATE 方法

    1.获取当前电脑的系统时间   var time = new Date();

    var time = new Date();//获取当前系统时间
    console.log(time); // Mon Apr 03 2017 09:03:18 GMT+0800 (中国标准时间)

    2.获取当前年    time.getFullYear();

    var time = new Date();
    var year = time.getFullYear();
    console.log(year);//2017

    3.获取当前月   time.getMonth();

    var time = new Date();
    var month = time.getMonth();
    console.log(month); //3

    4.获取当前天 time.getDate();

    var time = new Date();
    var day = time.getDate();
    console.log(day);3

    5.获取当前 (0-6代表周日-周六)time.getDay();

    var time = new Date();
    var week = time.getDay();
    console.log(week); //  1  (结果 0-6 周日、周一、周二...周六 )

    6.获取当前时间(当前小时整点) time.getHours();

    var time = new Date();
    var hours = time.getHours();
    console.log("hours   "+hours);//  10

    7.获取当前分钟(分钟) time.getMinutes();

    var time = new date();
    var minutes = time.getMinutes();
    console.log(minutes); //34

    8.获取当前秒 time.getSeconds();

    var  time = new date();
    var  seconds = time.getSeconds();
    console.log(seconds);

    9.获取当前毫秒 time.getMilliseconds();

    var time = new Date();
    var mlSeconds = time.getMilliseconds();
    console.log("miSeconds       "+mlSeconds);//  519

    10.

  • 相关阅读:
    Jmeter之CSV文件读取
    性能计数器及性能分析方法
    性能测试的应用领域
    动态加载JS文件方法总结
    handler method 参数绑定常用注解
    A4纸网页打印
    page-break-before和page-break-after 实现分页打印
    $.ajax 中的contentType
    @Controller和@RestController的区别?
    web页面内容打印总结
  • 原文地址:https://www.cnblogs.com/zzzzzzzsy/p/6661747.html
Copyright © 2011-2022 走看看