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

HTMLJavascriptProgramming Scripts

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>
raja
Published on 26-Feb-2018 07:28:27
Advertisements