How to Add Current Date and Time to Website Using JavaScript


Adding date and time to your web page is a nice thing to do since users doesn’t necessarily have to exit your page in order to check the date and time (although, they don’t necessarily have to leave your page in order to know the date and time since it is most probably displayed at the bottom right corner of every windows task bar). I want to believe that you must have seen this in some web pages and want to include it in your own page which is why you are viewing this.

There are so many ways via which one can achieve this but the method I want to show you requires just adding a simple JavaScript code to each of the pages you want the date and time appearing. All you need to do is copy the code snippet below and paste anywhere in your pages where you want the date and time to appear.

<script type=”text/javascript”>

document.write(“” + Date() );


Good thing is that by adding the above simple JavaScript code to your web page, you get to display not only the date and time but also the time zone which you are in.



Please enter your comment!
Please enter your name here