setMinutes()
Date
instance method setterS2C Home
« Globals « Date « setMinutes()
Description
Sets the locale specific minute of the hour (0-59) for the specified date.
Syntax
Signature | Description |
---|---|
aDate.setMinutes(minutesInt [, secondsInt[, millisecondsInt]]) | Sets the locale specific minute of the hour (0-59) for the specified date. |
Parameters
Parameter | Description |
---|---|
minutesInt | An integer in the range 0-59. |
secondsInt | An integer in the range 0-59.
|
millisecondsInt | An integer in the range 0-999.
|
For specified values outside the ranges above the setMinutes() method will try and set the date accordingly. |
Examples
The code below shows examples of the setMinutes()
method of Date
.
// Create a Date instance for the current date and time.
var todaysDate = new Date();
alert(todaysDate);
// Set minutes.
todaysDate.setMinutes(45);
alert(todaysDate + ' - Minutes set to 45');
// Set minutes and seconds.
todaysDate.setMinutes(25,15);
alert(todaysDate + ' - Minutes and seconds set');
Related Tutorials
JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times