//日期字符串转时间戳 var date="2015-03-18"; date = new Date(Date.parse(date.replace(/-/g, "/"))); date = date.getTime(); document.write(date); var date = new Date(); //返回当前的时间对象 getDate() //日 从 Date 对象返回一个月中的某一天 (1 ~ 31)。 getDay() //星期 从 Date 对象返回一周中的某一天 (0 ~ 6)。 getMonth() //月 从 Date 对象返回月份 (0 ~ 11)。 需要加 1 getFullYear() //年 从 Date 对象以四位数字返回年份。 getHours() //时 返回 Date 对象的小时 (0 ~ 23)。 getMinutes() //分 返回 Date 对象的分钟 (0 ~ 59)。 getSeconds() //秒 返回 Date 对象的秒数 (0 ~ 59)。
原文地址:http://blog.csdn.net/wujiangwei567/article/details/45337689