zoukankan      html  css  js  c++  java
  • Cocos Creator JS 获取当前日期与时间

    var testDate = new Date();

    testDate.getYear();//获取当前年份(2位)

    testDate.getFullYear(); //获取完整的年份(4位,1970-????)

    testDate.getMonth(); //获取当前月份(0-11,0代表1月)

    testDate.getDate(); //获取当前日(1-31)

    testDate.getDay(); //获取当前星期X(0-6,0代表星期天)

    testDate.getTime(); //获取当前时间(从1970.1.1开始的毫秒数)

    testDate.getHours(); //获取当前小时数(0-23)

    testDate.getMinutes(); //获取当前分钟数(0-59)

    testDate.getSeconds(); //获取当前秒数(0-59)

    testDate.getMilliseconds(); //获取当前毫秒数(0-999)

    testDate.toLocaleDateString(); //获取当前日期

    var mytime=testDate.toLocaleTimeString();//获取当前时间

    testDate.toLocaleString( ); //获取日期与时间

  • 相关阅读:
    如何判断栈的增长方向
    时间复杂度
    shell基础part3
    shell基础part2
    shell基础part2
    linux基础part5
    linux基础part4
    linux基础part3
    linux基础part2
    shell基础part1
  • 原文地址:https://www.cnblogs.com/luorende/p/9237614.html
Copyright © 2011-2022 走看看