zoukankan      html  css  js  c++  java
  • Date对象 识记

    1、Date 对象创建

    var myDate=new Date()

    2、Date 对象属性

    constructor

    pototype

    3、Date 对象方法

    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)。

    getMilliseconds()    返回 Date 对象的毫秒(0 ~ 999)。

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

    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)。

    setTime()               以毫秒设置 Date 对象。

    parse()                  返回1970年1月1日午夜到指定日期(字符串)的毫秒数。

  • 相关阅读:
    js 生成随机数
    解决微信浏览器无法使用reload()刷新页面
    js 去除左右空格
    小程序开发入门-第一天
    我的第一个JSP——动态web
    2019-3-6 复制粘贴
    2019-2-19 异常练习
    2019-1-19 object祖宗类的equals重写
    2019-1-15 课堂笔记
    2019-1-15 课后作业
  • 原文地址:https://www.cnblogs.com/xuemingyao/p/6282939.html
Copyright © 2011-2022 走看看