Michael Michael - 1 year ago 77
Javascript Question

How to subtract months in dates?

I have this dates function:

var isAnnual;
var setupDate="05/09/2016"
var currDate = new Date();//today

I need to check if subtraction of the months in dates above is equal to zero.

Any idea what is the best way to implement it?

Answer Source

Fetch the month from date and subtract it

Note: month starts from 0 i.e. Jan -0 , Dec -11

var s= new Date("05/09/2016");
var currDate = new Date();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download