js relatively longer than six months

 

// Mons relatively few months, such as 14:27:08 2019-02-01 - 2019-08-01 14:27:08 
function compareTime (Mons, sttime, endTime) {
     var ST = new new a Date (sttime);
     var et = new new a Date (endTime);
     var st6mon = new new a Date (ST); 
    st6mon.setMonth (st6mon.getMonth () + Mons); 
    
    IF (et.getTime ()> st6mon.getTime ()) {
       // the last one timeout starting from 6 months 
    return to true;
}
  return to false;
// PS: may be used if (et> (or <) st6mon), but the comparison if (et == st6mon) always returns false, may return == is a reference to the object address, so use the getTime () }

 

Guess you like

Origin www.cnblogs.com/xiaoliu66007/p/11976814.html
Recommended