Calculation time method in the client

xiaoxiao2021-03-06  57

Function dateDiff (Strinterval, Dtstart, Dtend) {

VAR DTSTART = New Date (dtstart);

IF (ISNAN (DTStart) DTStart = New Date ();

VAR DTEND = New Date (Dtend);

IF (ISNAN (Dtend) Dtend = New Date ();

Switch (strinterval) {

Case "S": Return Parseint (Dtend - DTStart) / 1000);

Case "N": Return PaSeint (Dtend - Dtstart) / 60000);

Case "H": Return Parseint (Dtend - Dtstart) / 3600000);

Case "D": Return Parseint (Dtend - Dtstart) / 86400000);

Case "W": Return Parseint (Dtend - DTStart) / (86400000 * 7));

Case "M": Return (Dtend.getmonth () 1) (Dtend.getFullyear () - DTSTART.GETFULLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLYEAR ()) * 12) - (DTStart.getMonth () 1);

Case "y": return Dtend.getFullyear () - DTStart.getFullyEar ();

}

}

转载请注明原文地址:https://www.9cbs.com/read-83623.html

New Post(0)