JavaScript: Show the current year (4 digits)
Use Javascript to show the current year in a HTML-document to display the date. Remember that Javascript is using the clients time-settings. . JavaScript Code: <script>document.write(new Date().getFullYear());</script> Output: 2019 And that’s everything needed to make this magic happen.