JavaScript Date setUTCMinutes()

Posted by

Method

JavaScript Date setUTCMinutes() Method

The setUTCMinutes() method sets the minutes for a specified date according to universal time. The setUTCMinutes() method takes a single argument, which is the number of minutes to set the date to.

Syntax

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

dateObj.setUTCMinutes(min, sec, ms)

[/dm_code_snippet]

  • min: An integer between 0 and 59, representing the minutes.
  • sec: An optional integer between 0 and 59, representing the seconds.
  • ms: An optional integer between 0 and 999, representing the milliseconds.

Return Value

The setUTCMinutes() method returns the number of milliseconds (from 1 January 1970 00:00:00 UTC) that have elapsed since 1 January 1970 00:00:00 UTC.

Example

Create a new date object and set the minutes to 10 using the setUTCMinutes() method.

[dm_code_snippet background=”yes” background-mobile=”yes” slim=”no” line-numbers=”no” bg-color=”#abb8c3″ theme=”dark” language=”php” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]

var d = new Date();
d.setUTCMinutes(10);

[/dm_code_snippet]

Browser Support

The setUTCMinutes() method is supported in all major browsers, including Internet Explorer, Firefox, Chrome, Safari, and Opera.