/

HTML / CSS / JavaScript Tutorial

JavaScript Date method: setDate()

[this page | pdf | back links]

The setDate() method (when applied to a JavaScript date) sets the date variable’s day of month.

 

It has the following syntax with the following parameters:

 

date.setDate(day)

 

Parameter

Required / Optional

Description

day

Required

Integer representing day of month. Typically, will be in range 1 – 31. However, 0 will result in last day of previous month, -1 the day before that etc., and e.g. 32 for a 30-day month will be second day of following month

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript Dates


Desktop view | Switch to Mobile