javascript日期+ 1 [英] javascript date + 1

查看:71
本文介绍了javascript日期+ 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用今天的日期并为其添加1天?

How do I take today's date and add 1 day to it?

如果可能,请在内联?

推荐答案

你必须使用Date对象的getDate()和setDate()方法分别获取和设置日期的日期值。

You have to use the getDate() and setDate() methods of the Date object which respectively get and set the day value of the date.

var date = new Date();
date.setDate(date.getDate() + 1);

检查MDC日期对象引用以获取有关使用日期的更多信息

Check the MDC Date object reference for more information on working with dates

这篇关于javascript日期+ 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆