By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,971 Members | 626 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,971 IT Pros & Developers. It's quick & easy.

One month Before Date

P: 34
Hai,
How Can i get the one month before Date from Current Date in Javascript. For Example,02/07/2012 is the Current Date. I need 01/07/2012
Feb 7 '12 #1
Share this Question
Share on Google+
2 Replies

Dormilich
Expert Mod 5K+
P: 8,639
do you need just the month or the complete date?

anyways, you can change the month my using setMonth().
Feb 7 '12 #2

P: 6
Hi there...

Expand|Select|Wrap|Line Numbers
  1. var myDate = new Date(document.getElementById("dateField").value);
  2. myDate.setMonth( myDate.getMonth() - 1 );
jackie
Feb 9 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.