Tutorial Gateway

  • C Language
  • Java
  • R
  • SQL
  • MySQL
  • Python
  • BI Tools
    • Informatica
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • QlikView
  • Js

JavaScript getUTCFullYear Function

by suresh

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

In this article, we will show you, How to use Get UTC Full Year in JavaScript Programming with an example.

Syntax of getUTCFullYear in JavaScript

The basic syntax for this getUTCFullYear function is:

 Date.getUTCFullYear()

JavaScript getUTCFullYear Function Example

The following example helps you understand the JavaScript get UTC Full Year Function. Here, we are using 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>

OUTPUT

JavaScript getUTCFullYear Function 1

JavaScript get UTC Full Year Function Example 2

In this 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>

OUTPUT

JavaScript getUTCFullYear Function 2

JavaScript get UTC FullYear Function Example 3

In this JavaScript 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>

OUTPUT

JavaScript getUTCFullYear Function 3

Placed Under: JavaScript

Stay in Touch!

Sign Up to receive Email updates on Latest Tutorials

  • C Programs
  • Java Programs
  • SQL FAQ’s
  • Python Programs
  • SSIS
  • Tableau
  • JavaScript

Copyright © 2019 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy