Home >>JavaScript Date Object Methods >JavaScript getUTCDate() Method
The getUTCDate() method is an inbuilt function in JavaScript which returns the day of the month in the specified date (from 1 to 31) according to universal time from a given object. Note that UTC time is the same as GMT time.
Syntax:Date.getUTCDate()
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
getUTCDate() | Yes | Yes | Yes | Yes | Yes |
<html> <body> <button onclick="myGetUTC()">Click me</button> <p id="Utcdate"></p> <script> function myGetUTC() { var d = new Date(); var a = d.getUTCDate(); document.getElementById("Utcdate").innerHTML = a; } </script> </body> </html>
<html> <body> <button onclick="myUTC()">Click me</button> <p id="UTC1"></p> <script> function myUTC() { var d = new Date("July7, 1997 02:28:00"); var c = d.getUTCDate(); document.getElementById("UTC1").innerHTML = c; } </script> </body> </html>