JavaScript & jQuery Tutorials

JS Home Right Arrow JS Reference Right Arrow Date Right Arrow setUTCSeconds()

setUTCSeconds()  Date  instance method


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


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


Parameter Description
secondsIntAn integer in the range 0-59.
millisecondsIntAn integer in the range 0-999.

  • If millisecondsInt not specified value returned from the getUTCMilliseconds() method is used.
For specified values outside the ranges above the setUTCSeconds() method will try and set the date accordingly.


The code below shows an example of the setUTCSeconds() method of Date.

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

// Set UTC seconds.
alert(todaysDate + ' - Seconds set to 59');

Press the button below to action the above code:

Related Tutorials

JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times


go to home page Homepage go to top of page Top