/    Sign up×
Community /Pin to ProfileBookmark

Post/Future Dates – 7 days

I need to find some script which shows a post date of 5, 6, and 7 days (separately) of the current date. I currently have some but when it get to the end of the month, like today, it is showing the 33rd March.

Can anyone help me??

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@felgallMar 30.2007 — <i>
</i>function daysfromnow(num) {
var calc = new Date();
calc.setDate(calc.getDate()+num);
return calc.getMonth()+'/'+calc.getDate()+'/'+calc.getFullYear();
}


pass in the number of days from now that you want the date for and the above function will return the correct date for that day in MM/DD/CCYY format. Use negative numbers if you need past dates.
×

Success!

Help @flickerwing spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...