Date getUTCDate() Method - Javascript Date

Javascript examples for Date:getUTCDate

Description

The getUTCDate() method returns the day of the month (from 1 to 31) of the date object, according to universal time.

UTC time is the same as GMT time.

Parameters

None

Return Value:

A Number, from 1 to 31, representing the day of the month

The following code shows how to return the day of the month, according to universal time:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from  w w w.  j a v a 2 s  .  co  m
    var d = new Date("July 21, 2020 01:15:00");
    var n = d.getUTCDate();
    document.getElementById("demo").innerHTML = n;
}
</script>

</body>
</html>

Related Tutorials