/** Date Parsing, string to date * @param datestring can return the corresponding Date object for 2017-02-16,2017/02/16,2017.02.16 * @returns {date} */ functionDateparse (datestring) {varSeparator_bar = "-"; varSeparator_slash = "/"; varSeparator_dot = "."; varDatearray; if(Datestring.indexof (Separator_bar) >-1) {Datearray=Datestring.split (Separator_bar); }Else if(Datestring.indexof (Separator_slash) >-1) {Datearray=Datestring.split (Separator_slash); }Else{Datearray=Datestring.split (SEPARATOR_DOT); } return NewDate (Datearray[0], datearray[1]-1, datearray[2]); }; /** * Date Comparison size * comparedatestring greater than datestring, return 1; * equals return 0; * comparedatestring less than datestring, return-1 * Date @param datestring Date * @param comparedatestring comparison*/ functionDatecompare (datestring, comparedatestring) {if(IsEmpty (datestring)) {alert ("DateString cannot be empty"); return; } if(IsEmpty (comparedatestring)) {alert ("Comparedatestring cannot be empty"); return; } varDateTime =Dateparse (datestring). GetTime (); varComparedatetime =Dateparse (comparedatestring). GetTime (); if(Comparedatetime >dateTime) { return1; }Else if(Comparedatetime = =dateTime) { return0; }Else{ return-1; } }; /** * To determine if the date is within the range , returns true within the interval, no return false * @param datestring Date String * @param startdatestring interval start date String * @param enddatestring interval End Date String * @returns {number}*/ functionIsdatebetween (datestring, startdatestring, enddatestring) {if(IsEmpty (datestring)) {alert ("DateString cannot be empty"); return; } if(IsEmpty (startdatestring)) {alert ("Startdatestring cannot be empty"); return; } if(IsEmpty (enddatestring)) {alert ("Enddatestring cannot be empty"); return; } varFlag =false; varStartflag = (Datecompare (datestring, startdatestring) < 1); varEndflag = (Datecompare (datestring, enddatestring) >-1); if(Startflag &&Endflag) {Flag=true; } returnFlag; }; /** * Determine if the date range [startdatecomparestring,enddatecomparestring] is completely within another date range [startdatestring,enddatestring] * i.e. [start Datestring,enddatestring] interval is completely inclusive of [startdatecomparestring,enddatecomparestring] interval * Returns true in the interval, no return false * @param Startdatestring the start date of the new selection, such as the start date of the input box * @param enddatestring the end date of the new selection, such as the end date of the input box * @param startdatecomparestring comparison Start Date * @param enddatecomparestring comparison End date * @returns {Boolean}*/ functionIsdatesbetween (startdatestring, enddatestring, startdatecomparestring, enddatecomparestring) { /c3>if(IsEmpty (startdatestring)) {alert ("Startdatestring cannot be empty"); return; } if(IsEmpty (enddatestring)) {alert ("Enddatestring cannot be empty"); return; } if(IsEmpty (startdatecomparestring)) {alert ("Startdatecomparestring cannot be empty"); return; } if(IsEmpty (enddatecomparestring)) {alert ("Enddatecomparestring cannot be empty"); return; } varFlag =false; varStartflag = (Datecompare (startdatecomparestring, startdatestring) < 1); varEndflag = (Datecompare (enddatecomparestring, enddatestring) >-1); if(Startflag &&Endflag) {Flag=true; } returnFlag; };</span>
JS date comparison size, JS judge whether the date in the interval, JS determine whether the time period in another time period
JS to determine whether the time interval in another time interval, JS time format, JS time comparison size
JS date comparison size, JS judge whether the date in the interval, JS determine whether the time period in another time period