JavaScript getMinutes() | Get the Minutes (0-59)

The JavaScript getMinutes() method is used to get the minutes (0-59) of the time. For example:

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

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

</body>
</html>
Output

JavaScript getMinutes() Syntax

The syntax of getMinutes() method in JavaScript is:

x.getMinutes()

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

The getMinutes() method returns a number from 0 to 59, which will be the minutes of the local time.

Please note: To display date in format dd-mm-yyyy, refer to its separate example.

Please note: To display time in format hh:mm:ss, refer to its separate example.

Please note: To display time in format hh:mm:ss AM/PM, refer to its separate example.

JavaScript Online Test


« Previous Tutorial Next Tutorial »