Set the day of the month for a specified date according to universal time?


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

The following is the parameter for setUTCDate(dayValue) −

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

Example

You can try to run the following code to set the day of the month for a specified date −

<html>
   <head>
      <title>JavaScript setUTCDate Method</title>
   </head>

   <body>
      <script>
         var dt = new Date( "Oct 15, 2017 23:30:00" );
         dt.setUTCDate( 20 );
         
         document.write( dt );
      </script>
   </body>
</html>

Updated on: 23-Jun-2020

51 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements