JavaScript Date.getUTCFullYear() method; Through this tutorial, i am going to show you JavaScript getUTCFullYear method with the help of it’s syntax, and examples.
Date.getUTCFullYear() Method in JavaScript
- JavaScript getUTCFullYear Method
- Syntax of JavaScript getUTCFullYear Method
- Example of JavaScript getUTCFullYear Method
JavaScript getUTCFullYear Method
Javascript date getUTCFullYear() method is used to get the full year in the specified date according to universal time. The getUTCFullYear method will return an integer value between 1000 and 9999.
Syntax of JavaScript getUTCFullYear Method
The syntax is date.getUTCFullYear method is:
Date.getUTCFullYear()
Example of JavaScript getUTCFullYear Method
Here, i will take an example of getUTCFullYear() method; as shown below:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript date.getUTCFullYear Method</title> </head> <body> <script type = "text/javascript"> var currentDate = new Date(); document.write("the javascript date.getUTCFullYear() : " + currentDate.getUTCFullYear() ); </script> </body> </html>
Note: If you want to use custom date with getUTCFullYear method, you can use like var date = new Date( "December 5, 1999 24:14:11" );
Result of the above code is
the javascript date.getUTCFullYear() : 2021
Conclusion
Through this tutorial, you have learned how to get a full year using getUTCFullYear function with the help of examples.
More JavaScript Tutorials
Recommended:-JavaScript Get Date Methods with Example
Recommended:-JavaScript Set Date Methods
Recommended:-JavaScript Variable Tutorial Example
Recommended:-JavaScript Operators List
Recommended:-JavaScript Data Types
Recommended:-JavaScript Arithmetic Operators
Recommended:-JavaScript Unary Operators Tutorial
Recommended:-JavaScript Assignment Operators
Recommended:-JavaScript Logical Operators with Example
Recommended:-JavaScript Comparison Operators Examples
Recommended:-JavaScript Ternary Operators Examples
Recommended:-JavaScript Switch Case Statement Tutorial
Recommended:-JavaScript While, Do-While, For and For-In Loops
Recommended:-JavaScript While Loop with Example
Recommended:-JavaScript do-while Loop with Example
Recommended:-JavaScript for Loop with Examples
Recommended:-Continue Statement in JavaScript
Recommended:-JavaScript Error Try-Catch Statement
Recommended:-Break Statement in JavaScript