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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.