The setUTCMinutes() method sets the minutes of a date object, according to UTC time.
The setUTCMinutes() method sets the minutes of a date object, according to UTC time.
UTC time is the same as GMT time.
Date.setUTCMinutes(min,sec,millisec)
Parameter | Require | Description |
---|---|---|
min | Required. | An integer representing the minutes. |
sec | Optional. | An integer representing the seconds |
millisec | Optional. | An integer representing the milliseconds |
For the minute value, the expected values are 0-59, but other values are allowed:
For the second value, the expected values are 0-59, but other values are allowed:
For the millisec value, the expected values are 0-999, but other values are allowed:
A Number, representing the number of milliseconds between the date object and midnight January 1 1970
Set the minutes to 17, according to UTC time:
//display the date after changing the minutes. var d = new Date(); d.setUTCMinutes(17);//from w w w .ja va2s . c o m console.log(d); //Set the date time to be 90 minutes ago, using UTC methods: //display the date after setting the time to be 90 minutes ago. var d = new Date(); d.setUTCMinutes(d.getUTCMinutes() - 90); console.log(d);