码迷,mamicode.com
首页 > Web开发 > 详细

JS日期(Date)处理函数总结

时间:2014-12-07 00:04:15      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:style   ar   使用   sp   strong   on   时间   as   tt   

获取日期

1、Date()

——返回当日的日期和时间。

2、getDate()

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

3、getDay()

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

4、getMonth()

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

5、getFullYear()

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

6、getYear()

——请使用 getFullYear() 方法代替。

7、getHours()
——返回 Date 对象的小时 (0 ~ 23)。

8、getMinutes()

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

9、getSeconds()

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

10、getMilliseconds()

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

11、getTime()

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

设置日期

1、setDate()

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

2、setMonth()

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

3、setFullYear()

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

4、setHours()

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

5、setMinutes()

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

6、setSeconds()

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

7、setMilliseconds()

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

8、setTime()

——以毫秒设置 Date 对象。

JS日期(Date)处理函数总结

标签:style   ar   使用   sp   strong   on   时间   as   tt   

原文地址:http://www.cnblogs.com/lidgblogs/p/4148906.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!