aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

JavaScript Display Current Time on Webpage or Website without Refreshing the Page

Oct 14, 2012

Here I will explain how to show or display current time on webpage or website in JavaScript.

In previous articles I explained JQuery display Current Time on WebPage,
Get Current Datetime, Disable right click on image and many articles relating to JQuery and JavaScript. Now I will explain how to show or display current time on webpage using jQuery.

To display current time on webpage or website using JavaScript we need to write the following code

<html xmlns="">
<head runat="server">
<title>JavaScript display current time on webpage</title>
<script type="text/javascript">
function ShowCurrentTime() {
var dt = new Date();
document.getElementById("lblTime").innerHTML = dt.toLocaleTimeString();
window.setTimeout("ShowCurrentTime()", 1000); // Here 1000(milliseconds) means one 1 Sec  
<body onload="ShowCurrentTime()">
<form id="form1" runat="server">
JavaScript Display current time second by second.
<label id="lblTime" style=" font-weight:bold"></label>

JavaScript Display current time second by second:

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Anonymous said...


Unknown said...

hi suresh i am great fan to u r website...u r examples are so much use full for me thank you for sharing all...plz share the mvc3 related posts plz

Unknown said...

hi suresh ji!!
your all articles are helping me lot.

thank you!!

Naveen Baghel said...

use full example.

Anonymous said...

Great Logic

Anonymous said...

Please put 4 tier Architecture Examples...

Akram said...

Very Nice Explanation given by Suresh Ji!!!!!!

Anonymous said...

great web site suresh you r brilliant

Anonymous said...

good one u give more current day ,month and year

Anonymous said...

I used the code on my asp webpage but it does show and the IDE shows no error, im using MS Visual Studio

Unknown said...

can u tell me how to add current month and year in title and it should be automatically updated

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.