Javascript Reference - JavaScript getUTCDate() Method








getUTCDate()
Returns the day of the month (1 through 31) for the UTC date.

UTC time is the same as GMT time.

Browser Support

getUTCDate() Yes Yes Yes Yes Yes

Syntax

dateObject.getUTCDate();

Parameters

None.

Return Value

return a number, from 1 to 31, representing the day of the month.





Example


var myDate = new Date();
console.log(myDate.getUTCDate());

The code above generates the following result.

Example 2

The following code shows how to get the UTC day of the month of a specific, local time, date-time:


<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!-- www.ja va2  s  .  c o  m-->
    var d = new Date("July 12, 1976 01:23:00");
    var n = d.getUTCDate();
    document.getElementById("demo").innerHTML = n;
}
</script>
</body>
</html>

The code above is rendered as follows: