Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Clock
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Clock

 Post Reply Post Reply Page  123>
Author
genmud View Drop Down
Groupie
Groupie
Avatar

Joined: 05 April 2003
Location: United States
Status: Offline
Points: 78
Post Options Post Options   Thanks (0) Thanks(0)   Quote genmud Quote  Post ReplyReply Direct Link To This Post Topic: Clock
    Posted: 24 June 2003 at 1:31am

Ok, here is what im trying to do...

im trying to get the Hours, Minutes and Seconds for a dynamic clock that will be off the server time... it will be cool because you can see the time on the server in real time... i am thinking of maybe making this into a mod if i get it finished real quick.

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2003 at 8:11am
whats wrong with just spitting out "Now()" ?
Contribute to the working anarchy we fondly call the Internet
Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2003 at 8:38am

HI.

If U want a live clock I have on in javascript but it is in danish so U have to changes the names and so on !!

http://www.javacoder.dk:56400/tid.htm

 

the code:

<table border="0" cellpadding="0" cellspacing="0" width="100%" style="font-family: Verdana; font-size: 10px" bgcolor="#ffffff">
          <tr>
            <td width="140">
              <p style="margin-left: 3; margin-top: 2; margin-bottom: 2">
             
<!--webbot bot="HTMLMarkup" startspan -->
<font color="#000000" size="1" face="Verdana">
<SCRIPT LANGUAGE="JavaScript"><!--
var ugeDag = new Array ("SØNDAG","MANDAG","TIRSDAG","ONSDAG","TORSDAG","FREDAG","LØRDAG")
var maaned = new Array ("JAN","FEB","MAR","APR","MAJ","JUN","JUL","AUG","SEP","OKT","NOV","DEC")
var nu = new Date
//-->
document.write( ugeDag[nu.getDay()] + " " + nu.getDate() + ". " + maaned[nu.getMonth()] + " " + nu.getFullYear() )
//-->
</SCRIPT></font>
<!--webbot bot="HTMLMarkup" endspan -->             
             
              </p>
            </td>
            <td width="90">
              <p style="margin-top: 4; margin-bottom: 4"><font color="#000000">&nbsp;-&nbsp;
              KLOKKEN
              ER</font></p>
            </td>
            <td width="100">
              <p style="margin-top: 2; margin-bottom: 2">
             
<script Language="JavaScript">
fon_size=1
fon_famil="Verdana"
fon_color="#000000"
var ns=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0

function tab_wri(nam_tab)
{
if(!ns)
 {
 document.write ("<DIV style='position:relative; left:0; top:0; width:"+(fon_size*5+2)+"'>")
 for (i=0; i<10; i++){document.write ("<DIV style='position:absolute; left:0; top:0; visibility:hidden ' ID='tab"+nam_tab+"_n"+i+"'><font face="+fon_famil+" size="+fon_size+" color="+fon_color+">"+i+"</font></DIV>")}
 document.write ("</DIV>")
 }
 else
 {
 document.write ("<ilayer id='ilay"+nam_tab+"'>")
 for (i=0; i<10; i++){document.write("<layer visibility=hide ID='lay"+nam_tab+"_n"+i+"'><font face="+fon_famil+" size="+fon_size+" color="+fon_color+">"+i+"</font></layer>")}
 document.write ("</ilayer>")
 }
}
function see_num(nam_tab,num_tab)
{
if(ie4)
 {
 for(i=0; i<10; i++)
  {
  if(i==num_tab){document.all["tab"+nam_tab+"_n"+num_tab].style.visibility="visible"}
  else{document.all["tab"+nam_tab+"_n"+i].style.visibility="hidden"}
  }
 }
if(ns)
 {
 for(i=0; i<10; i++)
  {
  if(i==num_tab){document.layers["ilay"+nam_tab].document.layers["lay"+nam_tab+"_n"+num_tab].visibility="show"}
  else{document.layers["ilay"+nam_tab].document.layers["lay"+nam_tab+"_n"+i].visibility="hide"}
  }
 }
if(ns6)
 {
 for(i=0; i<10; i++)
  {
  if(i==num_tab){document.getElementById("tab"+nam_tab+"_n"+num_tab).style.visibility="visible"}
  else{document.getElementById("tab"+nam_tab+"_n"+i).style.visibility="hidden"}
  }
 }

}
sec_old="0"
function see_tim()
{
date_=new Date()
wr_s=date_.getSeconds()+""

if(sec_old==wr_s){return}

sec_old=wr_s
wr_h=date_.getHours()+""
wr_m=date_.getMinutes()+""

if (wr_h.length==2){see_num(1,wr_h.charAt(0)); see_num(2,wr_h.charAt(1))}
else{see_num(1,0); see_num(2,wr_h.charAt(0))}

if (wr_m.length==2){see_num(3,wr_m.charAt(0)); see_num(4,wr_m.charAt(1))}
else{see_num(3,0); see_num(4,wr_m.charAt(0))}

if (wr_s.length==2){see_num(5,wr_s.charAt(0)); see_num(6,wr_s.charAt(1))}
else{see_num(5,0); see_num(6,wr_s.charAt(0))}

}

document.write ("<table  border=0 cellpadding=0 cellspacing=0><tr valign=top><td>")
tab_wri(1)
document.write ("</td><td>")
tab_wri(2)
document.write ("</td><td><font face="+fon_famil+" size="+fon_size+" color="+fon_color+">:</font>")
document.write ("</td><td>")
tab_wri(3)
document.write ("</td><td>")
tab_wri(4)
document.write ("</td><td><font face="+fon_famil+" size="+fon_size+" color="+fon_color+">:</font>")
document.write ("</td><td>")
tab_wri(5)
document.write ("</td><td>")
tab_wri(6)
document.write ("</td></tr></table>")

see_tim()
tim_int=window.setInterval("see_tim()",200)

</script>             
             
              </p>
            </td>
            <td width="420">
              <p style="margin-top: 2; margin-bottom: 2">&nbsp;</p>
            </td>
          </tr>
        </table>

Back to Top
Boecky View Drop Down
Groupie
Groupie
Avatar

Joined: 23 December 2002
Location: Belgium
Status: Offline
Points: 110
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boecky Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2003 at 9:03am
or you can use this code:

<script type="text/javascript">
<!--   // Array ofmonth Names
var monthNames = new Array( "January","February","March","April","May","June","July","August","September","October","November","December");
var now = new Date();
thisYear = now.getYear();
if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem
document.write(monthNames[now.getMonth()] + " " + now.getDate() + ", " + thisYear);
// -->
</script>
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2003 at 9:06am
unfortunately you guys missed the point that he was trying to show server time, not client side browser time
Contribute to the working anarchy we fondly call the Internet
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2003 at 10:08am

Originally posted by MorningZ MorningZ wrote:

whats wrong with just spitting out "Now()" ?

He means the time will increment not just stay static like if you use <%=now()%>...

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2003 at 10:29am

i'm perfectly aware of what he thinks can happen....  have a real time running clock of the server time (if i'm wrong on this, then the topic starter correct me) ....  something that in the Client-Server world known as the internet is not feasible (and my definition/tolerance of feasible might differ from someone else's obviously) since this would require a constant refresh between client on a web browser and the remote server hosting pages..

which if you even remotely had "sorta busy" traffic, this kinda setup would cause way uneccessary strain on the server......

Contribute to the working anarchy we fondly call the Internet
Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2003 at 12:41pm

like I wrote

Posted: 24 June 2003 at 8:38am | IP Logged

 

It is running after the server timer !! I have now test it on 3 servers and the time that the script is showing is the same time/clock as the servers !!!

 

Back to Top
 Post Reply Post Reply Page  123>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.