Thursday, September 24, 2020
Home Coding & Programming How to Add Current Date and Time to Website Using JavaScript

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

Most Popular

List of All JavaScript Arithmetic Operators With Examples

JavaScript offers several operators to help us work with numbers. All these operators are binary operators, which means they operate on two operands. The operands...

How to Find a Website’s RSS Feed’s URL

Having access to the RSS feed of a website gives you the opportunity to stay up-to-date on everything that website publishes. Whether that’s a...

Laravel: String data, right truncated: 1406 Data too long for column (SOLVED)

I was working on a project today when i ran into the error message "String data, right truncated: 1406 Data too long for column...

How to Enable or Disable Chrome’s Autofill on Android Devices

Storing your login details and other information in Chrome and/or your Google Account isn’t as secure as using an encrypted password manager, but it’s...

Recent Comments