[英]How to find the next 4 days from the current day using javascript
I found the current day as Mar 27 2012 .... 我发现今天是2012年3月27日...。
var currentday = currentday.format("mmm d yyyy");
I want to find the add three days with this value. 我想用此值查找添加三天。
ie i need the output as Mar 30 2012. 即我需要输出为2012年3月30日。
I also need to find the starting and ending date of a calendar. 我还需要找到日历的开始和结束日期。 ie Feb 26 2012 - Mar 31 2012 to display the current month as displaying in calendar month view.
即2012年2月26日至2012年3月31日,以在日历月视图中显示当前月份。
Can any one help me on this please.... 有人可以帮我这个忙吗?
var currentday = new Date();
var nextDay = new Date();
nextDay.setDate(currentday.getDate() + 4);
//Set number of days you want to compute to
var days=4;
//Get current date or whatever date you want to compute from
var currentDate=new Date();
var nDaysFromNow=new Date();
nDaysFromNow.setDate(currentDate.getDate()+days);
You can add days using the getDate() function like so: 您可以使用getDate()函数添加日期,如下所示:
var someDate = new Date();
someDate = someDate.getDate() + 3;
See code below.. Hope it helps 请参见下面的代码。希望对您有所帮助
var days = 4;
var next = new Date((new Date).getTime() + ((1000*3600*24) *days));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.