Title Several commonly used date functions chenzengxi (original) keyword dates
/ * - Calculate the date of the two characters (YYYY-MM-DD) - * / function date_compare (askDARTDATE, ASENDDATE) {var mistArt = Date.Parse (ASStartDate.Replace (// - / g, ') ')); Var Miend = Date.Parse (Asenddate.Replace (// - / g,' / ')); return (MIEND-MISTART) / (1000 * 24 * 3600);} / * - Judgment a character Whether the date (YYYY-MM-DD) is correct - * / function date_istrue (asdate) {var lsdate = askATE "" "" "" "; var = lsdate.split (" - "); if (Lodate.Length! = 3 Return False; var liyear = parseint (Lodate [0]); var limonth = parseint (Lodate [1]); var liday = parseint (Lodate [2]); if ((Lodate [0] .length> 4) | | (Lodate [1] .length> 2) || (Lodate [2] .length> 2)) Return False; if (ISNAN (Liyear) || IsNan (Limonth) || isnan (liday)) Return False; if ((Liyear <1900) | (liyear> 3000)) Return False; IF ((Limonth> 12) || (Limonth <= 0)) Return False; if (Date_Getday (Liyear, Limonth)