Date added functions AddDate (JavaScript)

xiaoxiao2021-03-05  20

// Adddate ("5", 5, "2004/12/1 00:00:00")

Function AddDate (Type, Numday, DTDATE) {

Var Date = New Date (DTDATE)

TYPE = PARSEINT (TYPE) // Type

Lintval = parseint (number) // interval

Switch (Type) {

Case 6: // year

Date.setyear (Date.GetyEAR () LintVal

Break;

Case 7: // quarter

Date.SetMonth (Date.GeTMONTH () (Lintval * 3)))

Break;

Case 5: // month

Date.setMonth (Date.GeTMONTH () LintVal

Break;

Case 4: //

Date.SetDate (Date.Getdate () LintVal)

Break

Case 3: //

Date.sethours (Date.GetHours () LintVal)

Break

Case 2: //

Date.Setminutes (Date.getminutes () LintVal)

Break

Case 1: // second

Date.setseconds (Date.GetSeconds () LintVal)

Break;

DEFAULT:

}

Return Date.GactYear () '-' 1) '-' Date.getdate () ' Date.GetHours () Date.getminutes () ':' Date.GetSeconds ()

}

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

New Post(0)