|
| JAVASCRIPT getMinutes() METHOD
The getMinutes() method in javascript returns the minutes of time as numbers from 0 to 59.
The general format is:
dateObject.getMinutes();
If you want to return the minutes with getMinutes() method, you will first have to create a new date object and then use the new date object with the getMinutes() method.
Example 1: Using getMinutes() for the minutes of the current time
<script type="text/javascript">
var mm=new Date(); // creates a new date object
mm=mm.getMinutes(); // returns the minutes
document.write(mm); // outputs the minutes
</script>
The above will output:
Example 2: Using getMinutes() to get the minutes of a specified date/time:
<script type="text/javascript">
var mm=new Date("January 16, 2008 21:37:23"); // creates a new date object
mm=mm.getMinutes(); // returns the minutes
document.write(mm); // outputs the minutes
</script>
The above will output:
See Also:
|
|