Time Format Date.prototype.Format = function (fmt) {var o = {"m+": This.getmonth () + 1, "d+": THIS.GETDA Te (), "h+": this.gethours (), "m+": This.getminutes (), "s+": This.getseconds (), "q+": Math.
Floor ((This.getmonth () + 3)/3), "S": This.getmilliseconds ()};
if (/(y+)/.test (FMT)) FMT = Fmt.replace (regexp.$1, (this.getfullyear () + ""). substr (4-regexp.$1.length)); For (var k in O) if (new RegExp ("+ K +")). Test (FMT)) FMT = Fmt.replace (regexp.$1, (regexp.$1.length = 1)?
(O[k]): (("+ o[k]"). substr (("" + o[k). length));
return FMT; //Calculation time difference-minutes function timedifference (time1, time2) {//Determine if start time is greater than end date if (Time1 > Time2) {alert ("Start time cannot be greater than the end time.
");
return false;
//intercept string var begin1 = time1.substr (0). Split ("-");
var end1 = time2.substr (0). Split ("-");
Regroup the split array and instantiate the new Date object var date1 = (Begin1[0] +-+ begin1[1] +-+ begin1[2); var date2 = new Date (End1[0] +-+ end1[1] +-+ end1[2]);
Gets the difference value m between two dates, in minutes var m = parseint (Math.Abs (date2-date1)/1000/60); The number of hours and minutes is added to get the total number of minutes//time1.substr (11,2) intercept a string to get the hours of Time//parseint (Time1.substr (11,2)) *60 convert hours into minutes var min1 = pa
Rseint (TIME1.SUBSTR (2)) * + parseint (TIME1.SUBSTR (14, 2));
var min2 = parseint (Time2.substr (one, 2)) * + parseint (TIME2.SUBSTR (14, 2));
Subtract two minutes to get the difference of time part, var n = min2-min1 in minutes;
var sec1 = parseint (Time1.substr (17, 2))/60;
var sec2 = parseint (Time2.substr (17, 2))/60;
var s = sec2-sec1;
Add the difference value calculated by the two parts of the date and time, that is, the number of minutes after subtracting two times var minutes = m + n+s;
Return minutes.tofixed (2);
}//time-plus minutes function addminutes (T, m) {var time = new Date (t);
Time.setminutes (Time.getminutes () + M, Time.getseconds (), 0); return time;