`
giga_Zhang
  • 浏览: 153563 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

JavaScript日期对象方法

阅读更多

Date Object Methods
日期对象方法

FF: Firefox, N: Netscape, IE: Internet Explorer
FF:火狐,N:网景,IE

Method
方法Description
描述FFNIE
Date()Returns today's date and time
返回今天的日期和时间
123
getDate()Returns the day of the month from a Date object (from 1-31)
返回月中的第几天(1到31)
123
getDay()Returns the day of the week from a Date object (from 0-6)
返回一周中的第几天(0到6)
123
getMonth()Returns the month from a Date object (from 0-11)
返回月份数(0到11)
123
getFullYear()Returns the year, as a four-digit number, from a Date object
返回完整的年份数
144
getYear()Returns the year, as a two-digit or a four-digit number, from a Date object. Use getFullYear() instead !!
返回年份,可以是两位的或是四位的
123
getHours()Returns the hour of a Date object (from 0-23)
返回日期对象的小时数(0到23)
123
getMinutes()Returns the minutes of a Date object (from 0-59)
返回日期对象的分钟(0到59)
123
getSeconds()Returns the seconds of a Date object (from 0-59)
返回日期对象的秒(0到59)
123
getMilliseconds()Returns the milliseconds of a Date object (from 0-999)
返回毫秒(0到999)
144
getTime()Returns the number of milliseconds since midnight Jan 1, 1970
从1970年1月1号午夜到现在一共花去的毫秒数
123
getTimezoneOffset()Returns the difference in minutes between local time and Greenwich Mean Time (GMT)
本地时间和GMT相差多少分钟
123
getUTCDate()Returns the day of the month from a Date object according to universal time (from 1-31)
依据国际时间来得到月中的第几天(1到31)
144
getUTCDay()Returns the day of the week from a Date object according to universal time (from 0-6)
依据国际时间来得到现在是星期几(0到6)
144
getUTCMonth()Returns the month from a Date object according to universal time (from 0-11)
依据国际时间来得到月份(0到11)
144
getUTCFullYear()Returns the four-digit year from a Date object according to universal time
依据国际时间来得到完整的年份
144
getUTCHours()Returns the hour of a Date object according to universal time (from 0-23)
依据国际时间来得到小时(0-23)
144
getUTCMinutes()Returns the minutes of a Date object according to universal time (from 0-59)
依据国际时间来返回分钟(0到59)
144
getUTCSeconds()Returns the seconds of a Date object according to universal time (from 0-59)
依据国际时间来返回秒(0到59)
144
getUTCMilliseconds()Returns the milliseconds of a Date object according to universal time (from 0-999)
依据国际时间来返回毫秒(0到999)
144
parse()Takes a date string and returns the number of milliseconds since midnight of January 1, 1970
或得并返回自1970年1月1号凌晨到现在一共花掉了多少毫秒
123
setDate()Sets the day of the month in a Date object (from 1-31)
设置日
123
setMonth()Sets the month in a Date object (from 0-11)
设置月
123
setFullYear()Sets the year in a Date object (four digits)
设置年份
144
setYear()Sets the year in the Date object (two or four digits). Use setFullYear() instead !!
用setFullYear()来取代
123
setHours()Sets the hour in a Date object (from 0-23)
设置小时
123
setMinutes()Set the minutes in a Date object (from 0-59)
设置分钟
123
setSeconds()Sets the seconds in a Date object (from 0-59)
设置秒
123
setMilliseconds()Sets the milliseconds in a Date object (from 0-999)
设置毫秒
144
setTime()Calculates a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970123
setUTCDate()Sets the day of the month in a Date object according to universal time (from 1-31)
依据国际时间来设置日期
144
setUTCMonth()Sets the month in a Date object according to universal time (from 0-11)
依据国际时间来设置月
144
setUTCFullYear()Sets the year in a Date object according to universal time (four digits)
依据国际时间来设置年份
144
setUTCHours()Sets the hour in a Date object according to universal time (from 0-23)
依据国际时间来设置小时
144
setUTCMinutes()Set the minutes in a Date object according to universal time (from 0-59)
依据国际时间来设置分钟
144
setUTCSeconds()Set the seconds in a Date object according to universal time (from 0-59)
依据国际时间来设置秒
144
setUTCMilliseconds()Sets the milliseconds in a Date object according to universal time (from 0-999)
依据国际时间来设置毫秒
144
toSource()Represents the source code of an object
显示对象的源代码
14-
toString()Converts a Date object to a string
将日期对象转换为字符串
124
toGMTString()Converts a Date object, according to Greenwich time, to a string. Use toUTCString() instead !!
根据格林威治时间将Date[日期]对象转换为一个字符串。可以使用toUTCString()替代这种方法
123
toUTCString()Converts a Date object, according to universal time, to a string
根据通用时间将一个Date[日期]对象转换为一个字符串
144
toLocaleString()Converts a Date object, according to local time, to a string
根据本地时间将一个Date[日期]对象转换为一个字符串
123
UTC()Takes a date and returns the number of milliseconds since midnight of January 1, 1970 according to universal time
根据通用时间将日期计算为从1970年1月1日午夜至今所经过的时间(单位:毫秒)
123
valueOf()Returns the primitive value of a Date object
返回日期对象的原始值
124


Date Object Properties
日期对象属性

Property
属性Description
描述FFNIE 
constructorA reference to the function that created the object
所建立对象的函数参考
144
prototypeAllows you to add properties and methods to the object
能够为对象加入的属性和方法
134
0
0
分享到:
评论

相关推荐

    Javascript 日期对象Date扩展

    解析常用的中文日期并返回日期对象。 add--日期加减操作。[注:此函数在上传时还存在一个BUG。请下载后把此函数内的第一行"var regExp = /^\d+$/;" 改为 "var regExp = /^([+-])?\d+$/;", 要不然就做不了减法。] ...

    JavaScript_对象方法实例集锦

    javascript的数组API ...最常用的JavaScript日期函数 最常用字符串函数API 数学函数 浏览器特征函数 用面向对象的编程方式写[removed] 常用的js方法,包括表单校验的一些方法,下拉菜单常用的方法等等 综合案例分析

    javascript转换日期字符串为Date日期对象的方法.docx

    javascript转换日期字符串为Date日期对象的方法.docx

    Javascript日期类型扩展

    新增Javascript 日期对象格式化, 新增农历对象

    javascript内值对象&浏览器对象 (1).docx

    一、JavaScript内置对象 JavaScript中的所有事物都是对象,如:字符串、数值、数组、函数等,每个对象带有属性和方法。 JavaScript提供多个内建...1、日期对象 (1) 定义一个时间对象 : var myDate=new Date(); ......

    javascript操作BOM对象.docx

    * `var 日期对象 = new Date(参数)`:创建一个 Date 对象,参数格式为 MM DD,YYYY,hh:mm:ss。 * `setTimeout()`:在制定的毫秒数后调用函数或计算表达式。 * `setInterval()`:按照制定的周期(以毫秒计)来调用函数...

    JavaScript:Math对象的用法及日期对象(包含案例)

    里面有Math对象的用法及日期对象的部分知识,适用于刚入门的友友们~

    javascript常用方法

    javascript常用方法:数组属性、方法;String对象属性、方法;以及日期、Math、Number等以及JavaScript 全局属性方法。

    [JavaScript] JavaScript 面向对象设计原则 (英文版)

    [No Starch Press] JavaScript 面向对象设计原则 (英文版) [No Starch Press] The Principles of Object-Oriented JavaScript (E-Book) ☆ 图书概要:☆ If you've used a more traditional object-oriented ...

    JavaScript Date(日期) 对象

    JavaScript Date(日期) 对象 日期对象用于处理日期和时间。 在线实例 使用 getFullYear() 获取年份。...我们提供 JavaScript Date 对象参考手册,其中包括所有可用于日期对象的属性和方法。JavaScript

    [JavaScript] 面向对象 JavaScript 第2版 英文版

    [Packt Publishing] 面向对象 JavaScript 第2版 英文版 [Packt Publishing] Object Oriented JavaScript 2nd Edition E Book ☆ 图书概要:☆ Think in JavaScript Make object oriented programming ...

    javascript格式化指定日期对象的方法

    主要介绍了javascript格式化指定日期对象的方法,涉及javascript针对日期对象操作的相关技巧,非常具有实用价值,需要的朋友可以参考下

    JavaScript日期对象(Date)基本用法示例

    主要介绍了JavaScript日期对象(Date)基本用法,结合实例形式较为详细的分析了JavaScript日期对象(Date)获取日期、时间戳、年月日、星期及日期比对等操作技巧,需要的朋友可以参考下

    Javascript日期对象的dateAdd与dateDiff方法

    先贴出我写的javascript代码,后面有使用参考。

    Javascript 日期对象Date扩展方法

    Date对象扩展,包括常用中文日期格式解析、加减操作、日期差、周操作和季操作。

    JavaScript 教学.zip

    目录 什麽是 JavaScript? 执行 JavaScript scripts ...第一个函数 输入型元件 日期功能 -- 最後修改期 状态栏 (statusbar)显功能 ...JavaScript的方法 JavaScript的事件 JavaScript的语法 JavaScript的保留字

    轻轻松松学用javascript编程(PDF)

    和多选钮(Checkbox) 的例子 3.4 JavaScript 中的字符串和日期对象. 3.4.1 字符串对象 3.4.2 日期对象 3.5 桢结构和框架窗口(Frame,IFrame) 3.5.1 了解链接的Target 属性 3.5.2 由JavaScript,在...

    javascript转换日期字符串为Date日期对象的方法

    本文实例讲述了javascript转换日期字符串为Date日期对象的方法。分享给大家供大家参考。具体如下: 这里实现把一个日期字符串如“2014-4-28 12:31:45”转换为Date对象: 方法一: 代码如下:var strArray=str.split...

Global site tag (gtag.js) - Google Analytics