> For the complete documentation index, see [llms.txt](https://date.gitbook.io/dateall/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://date.gitbook.io/dateall/javascript/methods/date.setminutes.md).

# Date.setMinutes()

The setMinutes() method sets the minutes for a specified date according to local time.

```javascript
var event = new Date('August 19, 1975 23:15:30');

event.setMinutes(45);

console.log(event.getMinutes());
// expected output: 45

console.log(event);
// expected output: Tue Aug 19 1975 23:45:30 GMT+0200 (CEST)
// (note: your timezone may vary)

```

## Syntax <a href="#syntax" id="syntax"></a>

```javascript
dateObj.setMinutes(minutesValue[, secondsValue[, msValue]])
```

#### Versions prior to JavaScript 1.3 <a href="#versions_prior_to_javascript_1.3" id="versions_prior_to_javascript_1.3"></a>

```
dateObj.setMinutes(minutesValue)
```

#### Parameters <a href="#parameters" id="parameters"></a>

`minutesValue`An integer between 0 and 59, representing the minutes.

`secondsValue`Optional. An integer between 0 and 59, representing the seconds. If you specify the `secondsValue` parameter, you must also specify the `minutesValue`.

`msValue`Optional. A number between 0 and 999, representing the milliseconds. If you specify the `msValue` parameter, you must also specify the `minutesValue` and `secondsValue`.

**Return value**

The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.

## Description

If you do not specify the `secondsValue` and `msValue` parameters, the values returned from [`getSeconds()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getSeconds) and [`getMilliseconds()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds) methods are used.

If a parameter you specify is outside of the expected range, `setMinutes()` attempts to update the date information in the [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object accordingly. For example, if you use 100 for `secondsValue`, the minutes will be incremented by 1 (`minutesValue + 1`), and 40 will be used for seconds.

## Examples <a href="#examples" id="examples"></a>

#### Using `setMinutes()` <a href="#using_setminutes" id="using_setminutes"></a>

```javascript
var theBigDay = new Date();
theBigDay.setMinutes(45);
```

## References <a href="#references" id="references"></a>

{% embed url="<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setMinutes>" %}

## Contributors to this page <a href="#contributors-to-this-page" id="contributors-to-this-page"></a>

Uros Durdevic


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://date.gitbook.io/dateall/javascript/methods/date.setminutes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
