Date.getUTCFullYear()

JavaScript 1.2+, ECMAScript 1E+, JScript 3.0+

Nav4+, IE 4+, Opera5+

 

Syntax

date.getUTCFullYear()

Description

The getUTCFullYear() method returns the year as a full four-digit number converted to universal time.

Example

The code in Listing 7.107 displays the year in universal time using the getUTCFullYear() method.

Listing 7.107 Using the getUTCFullYear() Method to Return the Year

<script type=“text/javascript” language=“JavaScript”><!-- //Create a Date object that contains the current date and time.theDate = new Date();//Display the full UTC year.document.write("The UTC year is ",theDate.getUTCFullYear());// --></script>

Date.getUTCHours()

JavaScript 1.2+, ECMAScript 1E+, JScript 3.0+

Nav4+, IE 4+, Opera5+

 

Syntax ...

Get Pure JavaScript, Second Edition 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.