setDate method

The setDate method allows you to change the value of the day of the month for date object.

Syntax

javascriptdate.setDate(day);

Example

Let's set the day:

javascriptlet date = new Date();
date.setDate(1);

console.log(date);

See also