zoukankan      html  css  js  c++  java
  • JavaScript之Math

    1. Math

    Math是js的内置函数,无需创建,把Math作为对象使用就可以调用其属性和方法。

    2.Date

       2.1 日期对象创建

    var now = new Date ( );

    含参数时表示距离1970年1月1日的毫秒数。

       2.2 日期处理

    oDate.getDate()          返回一个月中的某一天 (1 ~ 31)

     oDate.getDay()          返回一周中的某一天 (0 ~ 6)

     oDate.getMonth()       返回月份 (0 ~ 11)

     oDate.getFullYear()    以四位数字返回年份

    oDate.getHours()                       返回当前小时(0-23)

    oDate.getMinutes()                    返回当前分钟 (0 ~ 59)

    oDate.getSeconds()                   返回当前秒(0 ~ 59)

    oDate.getMillisenconds()           返回当前毫秒(0 ~ 999)

    oDate.getTime()                         返回1970年1月1日至今的毫秒数

    oDate.setDate()                         设置月中的某一天 (1 ~ 31)

     oDate.setMonth()                      设置月份 (0 ~ 11)

     例:oDate.setMonth(9);   alert(oDate.getMonth())

    oDate.setFullYear()                    设置年份(四位数)

    oDate.setHours()                       设置小时(0-23)

    oDate.setMinutes()                    设置分钟 (0 ~ 59)

    oDate.setSeconds()                   设置秒(0 ~ 59)

    oDate.setMillisenconds()          设置毫秒(0 ~ 999)

    oDate.setTime()                         设置1970年1月1日至今的毫秒数

  • 相关阅读:
    第04组 Alpha冲刺(1/6)
    第04组 团队Git现场编程实战
    第04组 团队项目-需求分析报告
    Codeforces 652F 解题报告
    团队项目-选题报告
    php 基础 字符串转整形
    php 基础 判断类型
    php 基础 自动类型转换
    php 算false的情况
    php redis 集群扩展类文件
  • 原文地址:https://www.cnblogs.com/a-peppa-pig/p/9460166.html
Copyright © 2011-2022 走看看