Does anybody know of an easy way of taking a date (e.g. Today) and going back X days?
So, for example, if I want to calculate the date 5 days before today.
Does anybody know of an easy way of taking a date (e.g. Today) and going back X days?
So, for example, if I want to calculate the date 5 days before today.
Using Modern JavaScript function syntax
it can give you only date like 2014-06-20. hope will help
I have created a function for date manipulation. you can add or subtract any number of days, hours, minutes.
Now, call this function by passing parameters. For example, here is a function call for getting date before 3 days from today.
I made this prototype for Date so that I could pass negative values to subtract days and positive values to add days.
So, to use it i can simply write:
I get good mileage out of date.js:
http://www.datejs.com/
Nice!
Website includes this beauty:
I noticed that the getDays+ X doesn't work over day/month boundaries. Using getTime works as long as your date is not before 1970.