C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Date getFullYear() methodThe JavaScript date getFullYear() method returns the year for the specified date on the basis of local time. SyntaxThe getFullYear() method is represented by the following syntax: dateObj.getFullYear() ReturnA number the represents year. JavaScript Date getFullYear() method exampleHere, we will understand getFullYear() method through various examples. Example 1Let's see an example to print the value of current year. <script> var year=new Date(); document.writeln(year.getFullYear()); </script> Output: 2018 Example 2Let's see an example to print the year from the given date. <script> var year=new Date("August 15, 1947 20:22:10"); document.writeln(year.getFullYear()); </script> Output: 1947
Next TopicJavaScript Math
|