您的位置:首页 > Web前端 > JavaScript

js中对日期进行加减

2012-02-23 23:01 381 查看
 

var today=new Date(); // 获取今天时间
today.setDate(today.getDate() + 7); // 系统会自动转换
下面是date类提供的三个你可能生成字符串用到的函数:
getDate() 从 Date 对象返回一个月中的某一天 (1 ~ 31)。
getMonth() 从 Date 对象返回月份 (0 ~ 11)。
getFullYear() 从 Date 对象以四位数字返回年份。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: