getMinutes() Method - Date and Time Function

getMinutes() method in Javascript
How to get the current minute in Javascript?


Object: Date
Method: getMinutes()
Description: This function will return the current minute of the hour. The minutes are displayed as integer values between 0 to 59.
Example Code:

<script type="text/javascript">
var x=new Date();
var y=x.getMinutes();
if (y<=30)
document.write('Minutes of first half hour');
document.write('Minutes of second half hour');



In the above example,

  • The Date() object returns the current day, year and month.

  • getMinutes() function is used to get the current minute of the hour.

  • Using a loop appropriate messages are displayed.

  • Ask Questions

    Ask Question