JavaScript Date setMinutes() Method
- Previous Page setMilliseconds()
- Next Page setMonth()
- Go Back to the Previous Level JavaScript Date Reference Handbook
Definition and Usage
setMinutes()
Method to set the minutes of the date object.
This method can also be used to set seconds and milliseconds.
Instance
Example 1
Set the minutes to 17:
var d = new Date(); d.setMinutes(17);
Example 2
Set the date and time to 90 minutes ago:
var d = new Date(); d.setMinutes(d.getMinutes() - 90);
Syntax
Date.setMinutes(min, sec, millisec)
Parameter Value
Parameter | Description |
---|---|
min |
Required. Represents the integer minutes. The expected value is 0-59, but other values are allowed:
|
sec |
Optional. Represents the integer seconds. The expected value is 0-59, but other values are allowed:
|
millisec |
Optional. Represents the integer milliseconds. The expected value is 0-999, but other values are allowed:
|
Technical Details
Return Value: | A number representing the milliseconds between the date object and midnight on January 1, 1970. |
---|---|
JavaScript Version: | ECMAScript 1 |
Browser Support
Method | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
setMinutes() | Support | Support | Support | Support | Support |
Related Pages
Tutorial:JavaScript Date
Tutorial:JavaScript Date Format
Tutorial:JavaScript Date Setting Methods
- Previous Page setMilliseconds()
- Next Page setMonth()
- Go Back to the Previous Level JavaScript Date Reference Handbook