setUTCMinutes()  Date  instance method JS Home  <<  JS Reference  <<  Date  <<  setUTCMinutes()

Description

Sets the UTC minute of the hour (0-59) for the specified date.

Syntax

Signature Description
aDate.setUTCMinutes(minutesInt [, secondsInt[, millisecondsInt]])Sets the UTC minute of the hour (0-59) for the specified date.

Parameters

Parameter Description
minutesIntAn integer in the range 0-59.
secondsIntAn integer in the range 0-59.
  • If secondsInt is not specified the value returned from the getUTCSeconds() method is used.
millisecondsIntAn integer in the range 0-999.
  • If millisecondsInt not specified value returned from the getUTCMilliseconds() method is used.
  • If millisecondsInt is specified you must also specify secondsInt.
For specified values outside the ranges above the setUTCMinutes() method will try and set the date accordingly.

Examples

The code below shows examples of the setUTCMinutes() method of Date.


// Create a Date instance for the current date and time.
var todaysDate = new Date();
alert(todaysDate);

// Set UTC minutes.
todaysDate.setUTCMinutes(45);
alert(todaysDate + ' - UTC Minutes set to 45');

// Set UTC minutes and seconds.
todaysDate.setUTCMinutes(25,15);
alert(todaysDate + ' - UTC Minutes and seconds set');

Press the button below to action the above code:

Related Tutorials

JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times