Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript setUTCMinutes() Method

JavaScript setUTCMinutes() Method

Date Object Reference JavaScript Date object

Example

Set the minutes field to 17 according to UTC time:

var d = new Date();

d.setUTCMinutes(17);

d Output according to local time:

Try it »


Definition and Usage

The setUTCMinutes() method is used to set the minutes of a specified time according to Universal Time (UTC).

**Note:** Coordinated Universal Time, also known as Universal Time, Universal Standard Time, or International Coordinated Time, abbreviated as UTC (Universal Coordinated Time).

**Note:** UTC time is the same as GMT (Greenwich) time.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the setUTCMinutes() method.


Syntax

Date

.setUTCMinutes(

min

,

sec

,

millisec

)

Parameter Values

Parameters Description
min Required. The value to set for the minutes field of date Object, expressed in universal time.

This parameter should be an integer between 0 and 59:

  • -1 is the last second of the previous minute
  • 60 is the first second of the next minute.
  • | | *sec* | Optional. The value to set for the seconds field of dateObject. Expressed in universal time.

    This parameter is an integer between 0 and 59:

    | | *millisec* | Optional. The value to set for the milliseconds field of date Object. Expressed in universal time.

    This parameter is an integer between 0 and 999:

    |

    Return Value

    Type Description
    Number The number of milliseconds from midnight in January 1970 to the set time.

    Technical Details

    JavaScript version: 1.3

    More examples

    Example

    In this example, we will set the minutes field of the current time to 90 minutes earlier using the setUTCMinutes() method:

    var d = new Date();

    d.setUTCMinutes(d.getUTCMinutes()-90);

    d Output according to the current time:

    Try it »


    Date Object Reference JavaScript Date object