JavaScript
-
语言参考
-
对象
- Date
启用基本存储器并取得日期和时间
名称
类型
说明
constructor
属性
表示创建对象的函数
getDate
方法
返回
Date
对象中用
本地时间
表示的一个月中的日期值
getDay
方法
返回
Date
对象中用
本地时间
表示的一周中的日期值
getFullYear
方法
返回
Date
对象中用
本地时间
表示的年份值
getHours
方法
返回
Date
对象中用
本地时间
表示的小时值
getMilliseconds
方法
返回
Date
对象中用
本地时间
表示的毫秒值
getMinutes
方法
返回
Date
对象中用
本地时间
表示的分钟值
getMonth
方法
返回
Date
对象中用
本地时间
表示的月份值
getSeconds
方法
返回
Date
对象中用
本地时间
表示的秒钟值
getTime
方法
返回
Date
对象中的时间值(以毫秒计量)
getTimezoneOffset
方法
返回用分钟表示的主计算机上的时间和
全球标准时间 (UTC)
之间的差别
getUTCDate
方法
返回
Date
对象中用
全球标准时间 (UTC)
表示的日期
getUTCDay
方法
返回
Date
对象中用
全球标准时间 (UTC)
表示的一周中的日期值
getUTCFullYear
方法
返回
Date
对象中用
全球标准时间 (UTC)
表示的年份值
getUTCHours
方法
返回
Date
对象中用
全球标准时间 (UTC)
表示的小时值
getUTCMilliseconds
方法
返回
Date
对象中用
全球标准时间 (UTC)
表示的毫秒值
getUTCMinutes
方法
返回
Date
对象中用
全球标准时间 (UTC)
表示的分钟值
getUTCMonth
方法
返回
Date
对象中用
全球标准时间 (UTC)
表示的月份值
getUTCSeconds
方法
返回
Date
对象中用
全球标准时间 (UTC)
表示的秒钟值
getYear
方法
返回
Date
对象中用
本地时间
表示的年份值(后两位)
parse
方法
解析一个包含日期的字符串,并返回该日期与 1970 年 1 月 1 日凌晨零点之间所间隔的毫秒数
prototype
只读属性
返回对象类型原型的引用
setDate
方法
设置
Date
对象中用
本地时间
表示的数字日期
setFullYear
方法
设置
Date
对象中用
本地时间
表示的年份值
setHours
方法
设置
Date
对象中用
本地时间
表示的小时值
setMilliseconds
方法
设置
Date
对象中用
本地时间
表示的毫秒值
setMinutes
方法
设置
Date
对象中用
本地时间
表示的分钟值
setMonth
方法
设置
Date
对象中用
本地时间
表示的月份值
setSeconds
方法
设置
Date
对象中用
本地时间
表示的秒钟值
setTime
方法
设置
Date
对象中用
本地时间
表示的时间值
setUTCDate
方法
设置
Date
对象中用
全球标准时间 (UTC)
表示的数字日期
setUTCFullYear
方法
设置
Date
对象中用
全球标准时间 (UTC)
表示的年份值
setUTCHours
方法
设置
Date
对象中用
全球标准时间 (UTC)
表示的小时值
setUTCMilliseconds
方法
设置
Date
对象中用
全球标准时间 (UTC)
表示的毫秒值
setUTCMinutes
方法
设置
Date
对象中用
全球标准时间 (UTC)
表示的分钟值
setUTCMonth
方法
设置
Date
对象中用
全球标准时间 (UTC)
表示的月份值
setUTCSeconds
方法
设置
Date
对象中用
全球标准时间 (UTC)
表示的秒值
setYear
方法
设置
Date
对象中用
全球标准时间 (UTC)
表示的年份值(后两位)
toDateString
方法
以字符串值的形式返回一个日期
toGMTString
方法
返回一个日期,该日期用
全球标准时间 (UTC)
表示并已被转换为字符串
toLocaleDateString
方法
以字符串的形式返回与宿主环境的当前区域设置相对应的日期
toLocaleString
方法
返回一个日期,该日期使用当前区域设置并已被转换为字符串
toLocaleTimeString
方法
以字符串的形式返回与宿主环境的当前区域设置相对应的时间
toSource
方法
以字符串的方式返回对象的源定义
toString
方法
返回一个表示该对象的字符串
toTimeString
方法
以字符串形式返回时间
toUTCString
方法
返回一个已被转换为字符串的,用
全球标准时间 (UTC)
表示的日期
UTC
方法
返回
全球标准时间 (UTC)
的 1970 年 1 月 1 日到所指定日期之间所间隔的毫秒数
valueOf
方法
返回指定对象的原始值
版本(Version)
JScript 1.0+
IE 3.0+
ECMAScript 1.0+
JavaScript 1.0+
Netscape 2.0+
Navigator 2.0+
Opera 3.0+