Home >>JavaScript Date Object Methods >JavaScript setUTCDate() Method
JavaScript setUTCDate() method is used to set the given input day of the month according to the universal time (UTC). UTC is the Universal Coordinated Time set by the World Time Standard.
Syntax:Date.setUTCDate(day)
Parameter | Description |
---|---|
day | This is a required parameter. If defines an integer representing the day of a month. |
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
setUTCDate() | Yes | Yes | Yes | Yes | Yes |
<html> <body> <p>Click the button to see the OPutput.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var d = new Date(); d.setUTCDate(14); document.getElementById("demo").innerHTML = d; } </script> </body> </html>
Click the button to see the Output.
<html> <body> <p>Click the button to see the Output.</p> <button onclick="myFunction1()">Try it</button> <p id="demo1"></p> <script> function myFunction1() { var d = new Date("March 10, 2020 15:15:00"); d.setUTCDate(08); document.getElementById("demo1").innerHTML=d; } </script> </body> </html>
Click the button to see the Output.