JavaScript getUTCDate() | Get the UTC Day of the Month (1-31)

The JavaScript getUTCDate() method is used to get the day of the month (1-31) according to Universal Time Coordinated (UTC) or Greenwich Mean Time (GMT). For example:

HTML with JavaScript Code
<!DOCTYPE html>
<html>
<body>
   
   <p id="xyz"></p>

   <script>
      const d = new Date();
      let day = d.getUTCDate();
      document.getElementById("xyz").innerHTML = day;
   </script>

</body>
</html>
Output

JavaScript getUTCDate() Syntax

The syntax of getUTCDate() method in JavaScript is:

x.getUTCDate()

where x must be an object of the Date() constructor.

The getUTCDate() method returns a number from 1 to 31 which will be the day of the month based on the UTC time.

Print Day of the Month based on UTC in JavaScript

HTML with JavaScript Code
<!DOCTYPE html>
<html>
<body>
   
   <p>Today's Date: <span id="res"></span></p>

   <script>
      const d = new Date();
      document.getElementById("res").innerHTML = d.getUTCDate();
   </script>

</body>
</html>
Output

Today's Date:

JavaScript Online Test


« Previous Tutorial Next Tutorial »