Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add clock (time) to my web site. I am working with visual studio 2005 any javascript or html or asp .net codes would be helpful
Thanks
Posted
Updated 4-Jun-12 10:28am
v2
Comments
Sandeep Mewara 17-Jun-11 5:27am    
Tried anything?

Surprisingly, this has been done before!
Even more amazingly, there is a tool out there that helps you find such things!
Google using your subject line[^]
 
Share this answer
 
Hi this code a clock and change by server time

<script language="JavaScript">
<!-- Begin
function showMilitaryTime() {
if (document.form.showMilitary[0].checked) {
return true;
}
return false;
}
function showTheHours(theHour) {
if (showMilitaryTime() || (theHour > 0 && theHour < 13)) {
if (theHour == "0") theHour = 12;
return (theHour);
}
if (theHour == 0) {
return (12);
}
return (theHour-12);
}
function showZeroFilled(inValue) {
if (inValue > 9) {
return "" + inValue;
}
return "0" + inValue;
}
function showAmPm() {
if (showMilitaryTime()) {
return ("");
}
if (now.getHours() < 12) {
return (" am");
}
return (" pm");
}
function showTheTime() {
now = new Date
document.form.showTime.value = showTheHours(now.getHours()) + ":" + showZeroFilled(now.getMinutes()) + ":" + showZeroFilled(now.getSeconds()) + showAmPm()
setTimeout("showTheTime()",1000)
}
</script>
-->
 
Share this answer
 
i have that code i will send u soon

which is javascript

we can acieve time by 'settimeout()' function

try to work on remaining
 
Share this answer
 
Comments
esmailian 16-Jun-11 15:24pm    
Hi I make this code in following
use this js

C#
function display() {
    var Today = new Date();
    var hours = Today.getHours();
    var min = Today.getMinutes();
    var sec = Today.getSeconds();
    var mth=Today.getMonth()+1;
    var dt = Today.getDate()+"/"+ mth +"/" + Today.getFullYear() ;

    var Time=dt + "- " ;
    Time += ((hours > 12) ? hours - 12 :(hours == 0) ? 12 :hours);
    Time += ((min < 10) ? ":0" : ":") + min;
    Time += ((sec < 10) ? ":0" : ":") + sec;
    Time += (hours >= 12) ? " PM" : " AM";
    window.status = Time;
    setTimeout("display()",60000);
  }

display();
 
Share this answer
 
Comments
Manas Bhardwaj 4-Jun-12 16:30pm    
why are you reopening an year old thread?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900