zoukankan      html  css  js  c++  java
  • 常用的内置对象

    创建Date对象方法

    new Date()

    new Date(month dd,yyyy hh:mm:ss)

    new Date(yyyy,mth,dd,hh,mm,ss)

    new Date(yyyy,mth,dd)

    new Date(ms)

    Date对象获取时间细节方法:

    getDate()

    从Date对象返回一个月中的某一天(1~31)

    getDay()

    从Date对象返回一周中的某一天(0~6)

    getMonth()

    从Date对象返回月份(0~11)

    getFullYear()

    从Date对象以四位数字返回年份

    getHours()

    返回Date对象的小时(0~23)

    getMinutes()

    返回Date对象的分钟(0~59)

    getSeconds()

    返回Date对象的秒数(0~59)

    getTime()

    返回1970年1月1日至今的毫秒数

    Date对象设置时间的方法:

    setDate()

    设置Date对象中月的某一天(1~31)

    setMonth()

    设置Date对象中月份(0~11)

    setFullYear()

    设置Date对象中的年份(四位数字)

    setHours()

    设置Date对象中的小时(0~23)

    setMinutes()

    设置Date对象中的分钟(0~59)

    setSeconds()

    设置Date对象中的秒钟(0~59)

    setMilliseconds()

    设置Date对象中的毫秒(0~999)

    Math对象的常用方法:

    abs(x)

    返回数的绝对值

    ceil(x)

    对数进行上舍入

    floor(x)

    对数进行下舍入

    max(x,y)

    返回x和y中的最高值

    min(x,y)

    返回x和y中的最低值

    pow(x,y)

    返回x的y次幂

    random()

    返回0~1之间的随机数

    round(x)

    把数四舍五入为最接近的整数

    sqrt(x)

    返回数的平方根

  • 相关阅读:
    PHP中get请求中参数的key不能是para
    js对数组中的数字排序
    js 数组不重复添加元素
    Controllers
    Views
    Models
    Requirements
    Pull Requests
    Upgrade Guide
    Overview & Change Log
  • 原文地址:https://www.cnblogs.com/sy130908/p/11161655.html
Copyright © 2011-2022 走看看