/    Sign up×
Community /Pin to ProfileBookmark

How to find a date which is one week before to current Date.

Hi folks? ,

here is my code to get a date which is one week before to currrent date but,
current date is 7th july 2007 and function returning date 11/25/1969(MM/DD/YYYY).

<html>
<body>
<script>
function getNewDate(){
var date = new Date();
var ms1=date.getMilliseconds();
alert(“SO”);
var ms2=(86400*7*1000);
alert(“here”);
var ms3=ms1-ms2;
var weekAhead=new Date(ms3);
alert(“NEW DATE “+weekAhead.getMonth()+”/”+weekAhead.getDate()+”/”+weekAhead.getFullYear());
}
</script>
<input type=”button” name=”” value=”date” onclick=”getNewDate()”/>
</body>
</html>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangJun 07.2007 — Please don't start a new post. Answer is in previous post
Copy linkTweet thisAlerts:
@rootJun 07.2007 — Their should be a new forum rule about making multiple posts asking the same or a similar worded question, namely they should be banned for something like an hour which is increased for 2 on the next infringement then 4 then 8 and so on until the the person gets the message to search for their previous posted question.

In saying that, the forum doesnt exactly help either, it is a long process of several clicks to get to your "Posts" list, something that should be accessable easily from where it says Welcome, <username>, the <username> links to a search for "Your" posts made...

Or we could just shoot them!
×

Success!

Help @rajeshwarreddyt 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...