Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How should Jquery add days to the current date?
How should Jquery add days to the current date?
Like this:

//method add day $ NUMBER days (plastic), date: if there is no transmission, use today (date type)

Function? AddDay(dayNumber, date) {

Dating? =? Dating? :? New? date();

var? ms? =? What day is it? *? ( 1000? *? 60? *? 60? *? 24)

var? New date? =? New? Date(date.getTime()? +? ms);

Return? New date;

}? var? date = addDay(3);

Extended data:

Matters needing attention

Js time has nothing to do with jquery. Js native date class is used for processing. If you get an instance of the Date class, use setDate and getDate for processing.

For example, if there is a Date instance date, five days should be added: date.setdate (date.getdate ()+5); After that, the date instance is the date and time five days later.

If it is a string date and time, use the parse method to convert it: var date = date. parse ("date time string"); Then do the above operation.