We need to substract one day for the given date. The given date is '24-03-2017'. By using the below javascript code get previous date.
var date = '24-03-2017'; var nextday = new Date(date.setTime( date.getTime() - 1 * 86400000 ));
var day = nextday.getDate(); var months = (nextday.getMonth() + 1); // Months use 0 index. var nextdate= nextday.getFullYear()+'-'+(months[1] ? month : '0'+ months[0]) + '-' + (day[1] ? day : '0'+ day[0]);
The result is :
22-03-2017
You might also like:
Compare the Triplets | Javascript | hackerrank.com07-05-2020 hackerrank.com |
How To Get Your Blogs Posts Using Blogger API30-07-2017 blogger api json php |
How to make an http request in node js14-03-2017 http module node js |
How to get drop down value when drop down change using javascript27-02-2017 onchange events dropdown javascript functions |
Call a function every second or 5 seconds in javascript22-02-2017 setinterval function calling |