Hi All,
I need to get past 30 days date as on current date (Date() - 30) i.e. (29/01/2013 - 30) should be 30/12/2012.
Could guide me to achieve this output in Javascript
Regards
Shehzad
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jan 28, 2013, 10:32 PM
try following code, it might help you.
var numberOfDaysToAdd = -30;
var today = new Date();
today.setDate(today.getDate() + numberOfDaysToAdd);
in varible today you may get result date i.e. 30/12/2012
hope this will help you.
ShehzadPosted Jan 28, 2013, 11:33 PM