JavaScript getUTCFullYear Function

JavaScript getUTCFullYear function is a Date Function, which returns the year in a given date according to universal time. The syntax of the JavaScript getUTCFullYear function is:

 Date.getUTCFullYear()

JavaScript getUTCFullYear Function Example

We use the getUTCFulYear to return the year from the current date and time.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript Get UTC Full Year Function </title>
</head>
<body>
    <h1> JavaScript getUTCFullYear Function Example </h1>
<script>
  var dt = Date();  
  document.write("Date and Time : " + dt);
  document.write("UTC Full Year using getUTCFullYear : " + dt.getUTCFullYear());
</script>
</body>
</html>
JavaScript getUTCFullYear Function Example

Date and Time: Mon Nov 05 2018 10:52:54 GMT+0530 (Indian Standard Time)
UTC Full Year using getUTCFullYear : 2018

JavaScript get UTC Full Year Example 2

In this JavaScript example, we are displaying the year from the custom date

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript Get UTC Full Year Function </title>
</head>
<body>
    <h1> JavaScript getUTCFullYear Function Example </h1>
<script>
  var dt = Date("April 1, 2016 10:14:22");
  document.write("Date and Time : " + dt);
  document.write("UTC Full Year using getUTCFullYear : " + dt.getUTCFullYear());
</script>
</body>
</html>
JavaScript getUTCFullYear Function 2

JavaScript get UTC FullYear Function Example 3

In this getUTCFullYear example, we are displaying the Year from the custom date without the year. This returns the default year as the output.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript Get UTC Full Year Function </title>
</head>
<body>
    <h1> JavaScript getUTCFullYear Function Example </h1>
<script>
  var dt = Date("April 1 10:14:22");
  document.write("Date and Time : " + dt);
  document.write("UTC Full Year using getUTCFullYear : " + dt.getUTCFullYear());
</script>
</body>
</html>
JavaScript getUTCFullYear Function Example

Date and Time: Sun Apr 01 2001 10:14:22 GMT+0530 (Indian Standard Time)
UTC Full Year using getUTCFullYear : 2001