10 examples of 'javascript add minutes to date' in JavaScript

Every line of 'javascript add minutes to date' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
50function addMinutes(date, minutes) {
51 return new Date(date.getTime() + minutes * 60000);
52}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

7export function addMinutes(d, minutes) {
8 const newDate = clone(d);
9 newDate.setMinutes(d.getMinutes() + minutes);
10 return newDate;
11}
19function addMinutes(d, minutes) {
20 var newDate = clone(d);
21 newDate.setMinutes(d.getMinutes() + minutes);
22 return newDate;
23}
159function addMinutes(date, value) {
160 return new Date(+date + value * 60000);
161}
181function setMinutes (date, minutes) {
182 return _getMoment(date).minutes(minutes).toDate()
183}
123public getMinutes(date: Moment) {
124 return date.get("minutes");
125}
66function getMinutes(dateTime) {
67 var hours = dateTime.getHours();
68 var minutes = dateTime.getMinutes();
69 var seconds = dateTime.getSeconds();
70
71 if (Date.prototype.isDST()) {
72 hour -= 1;
73 }
74
75 return hours * 60 + minutes + seconds / 60.0;
76}
85export function setMinutes(date: Date, value: number, isUTC?: boolean): Date {
86 isUTC ? date.setUTCMinutes(value) : date.setMinutes(value);
87
88 return date;
89}
13function addHours(d, hours) {
14 var newDate = clone(d);
15 newDate.setHours(d.getHours() + hours);
16 return newDate;
17}
200public addMinutes(value: number): DateTime {
201 const clone = this.cloneDate();
202
203 clone.setTime(clone.getTime() + (value * 60 * 1000));
204
205 return new DateTime(clone);
206}

Related snippets