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日午夜到指定日期(字符串)的毫秒数。

  • 相关阅读:
    【POJ2176】Folding
    【NOIP2018】赛道修建
    优雅的文本编辑器——Sublime Text 3的搭建与使用
    【NOIP2010】乌龟棋
    【POJ3585】Accumulation Degree
    【POJ3322】Bloxorz I
    python之路_常用模块介绍
    python之路_正则表达式及re模块
    python之路_内置函数及匿名函数
    python之路_递归函数及实例讲解
  • 原文地址:https://www.cnblogs.com/xuemingyao/p/6282939.html
Copyright © 2011-2022 走看看