ES6 - setDate() Method


Advertisements


JavaScript date setDate() method sets the day of the month for a specified date according to local time.

Syntax

Date.setDate( dayValue )      

Parameter

  • dayvalue − An integer from 1 to 31, representing the day of the month.

Example

var dt = new Date( "Aug 28, 2008 23:30:00" ); 
dt.setDate( 24 ); 
console.log( dt )    

Output

Sun Aug 24 2008 23:30:00 GMT+0530 (India Standard Time)     

es6_date.htm

Advertisements