Date.getUTCSeconds()

JavaScript 1.2+, ECMAScript 1.0+, JScript 3.0+ Nav4+, IE 4+ Syntax

							date.getUTCSeconds()

Description

The getUTCSeconds() method returns the seconds portion of the Date object, converted to universal time and expressed as an integer from 0 to 59.

Example

The code in Listing 6.88 displays the current second in universal time using the getUTCSeconds() method.

Listing 6.88 Using the getUTCSeconds() Method to Return the Current Second
<html>

<script language="JavaScript">
<!–– Hide

//Create a Date object that contains the current date and time.
theDate = new Date();

//Display the UTC seconds
document.write("The UTC seconds is ",theDate.getUTCSeconds());

//Hide End ––>
</script>
							
							

</html>

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.