JavaScript setMinutes()Method
Example
Set the minutes field to 17:
var d = new Date();
d.setMinutes(17);
d.setMinutes(17);
dOutput:
Try it Yourself »
Definition and Usage
The setMinutes() method is used to set the minutes field of a specified time.
This method can also be used to set the seconds and milliseconds.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the setMinutes() method
Syntax
Date.setMinutes(min,sec,millisec)
Parameter Values
| Parameter | Description |
|---|---|
| min | Required. A numeric value representing the minutes, Between 0 and 59, in local time (the same below):
|
| sec | Optional. A numeric value representing the seconds, Between 0 and 59. This parameter is not supported before ECMAScript standardization:
|
| millisec | Optional. A numeric value representing the milliseconds, Between 0 and 999. This parameter is not supported before ECMAScript standardization:
|
Return Value
| Type | Description |
|---|---|
| Number | Returns the number of milliseconds from January 1, 1970 to the adjusted date. Before ECMAScript standardization, this method returned nothing. |
Technical Details
| JavaScript Version: | 1.0 |
|---|
More Examples
Example
Set the date to 90 minutes ago:
var d = new Date();
d.setMinutes(d.getMinutes()-90);
d.setMinutes(d.getMinutes()-90);
dOutput:
Try it Yourself »
Other Extensions
JavaScript Date Object