Easy Tutorial
❮ Prop Textarea Rows Prop Style Bordertopstyle ❯

JavaScript setMinutes() Method

JavaScript Date Object

Example

Set the minutes field to 17:

d Output result:


Definition and Usage

The setMinutes() method is used to set the minutes field for 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

Parameter Values

Parameter Description
min Required. A number representing the minutes, between 0 and 59, based on local time: -1 is the last minute of the previous hour<br>60 is the first minute of the next hour
sec Optional. A number representing the seconds, between 0 and 59. Before EMCAScript standardization, this parameter was not supported: -1 is the last second of the previous minute<br>60 is the first second of the next minute
millisec Optional. A number representing the milliseconds, between 0 and 999. Before EMCAScript standardization, this parameter was not supported: -1 is the last millisecond of the previous second<br>1000 is the first millisecond of the next second

Return Value

Type Description
Number Returns the number of milliseconds since 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:

d Output result:


JavaScript Date Object

❮ Prop Textarea Rows Prop Style Bordertopstyle ❯