JavaScript getMinutes Function

JavaScript getMinutes function is one of the Date Function, which returns the number of minutes in a given date.

JavaScript getMinutes Function Example

The following JavaScript getMinutes function returns the total minutes in the current date and time.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript Get Minutes Function </title>
</head>
<body>
    <h1> JavaScript getMnutes Function Example </h1>
<script>
  var dt = Date();  
  document.write("Date and Time : " + dt);
  document.write("Minutes from getMinutes(): " + dt.getMinutes());
</script>
</body>
</html>
JavaScript getMinutes Function 1

JavaScript get Minutes Function Example

In this get minutes example, we are extracting the minutes from the custom date

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript Get Minutes Function </title>
</head>
<body>
    <h1> JavaScript getMinutes Function Example </h1>
<script>
  var dt = Date("April 31, 2012 12:09:07");
  document.write("Date and Time : " + dt);
  document.write("Minutes from getMinutes(): " + dt.getMinutes());
</script>
</body>
</html>
JavaScript getMinutes Function Example

Date and Time: Tue May 01 2012 12:09:07 GMT+0530 (Indian Standard Time)
Minutes from getMinutes(): 9

JavaScript get Minutes Function Example

In this JavaScript get Minutes example, we extract the minutes from the custom date without time (minutes). This will return 0 minutes.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript Get Minutes Function </title>
</head>
<body>
    <h1> JavaScript getMinutes Function Example </h1>
<script>
  var dt = Date("April 31, 2012");
  document.write("Date and Time : " + dt);
  document.write("Minutes from getMinutes(): " + dt.getMinutes());
</script>
</body>
</html>
JavaScript getMinutes Function Example

Date and Time: Tue May 01 2012 00:00:00 GMT+0530 (Indian Standard Time)
Minutes from getMinutes(): 0