adding time with seconds that is Eastern Standard Time

Hello,

How do I add the time to my page that is Eastern Standard Time (2 hours ahead of me)?

I want it to change with each second, and look like  05:32:30.

Thank you,  
Bob
LVL 7
weikelbobAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EsopoCommented:
The second updating is done with javascript. You should be able to find half-a-dozen of such scripts with a google.com search.
To make sure the time is correct you need to pull it out of a server. Do you have any server side scripting language available?

Best regards,

Esopo.
0
weikelbobAuthor Commented:
I have PHP. How do I pull the time out of the server, and can I make it Eastern Standard Time?

I'll go to google to get started.

Thank you,

Bob
0
EsopoCommented:
Once you are comfortable with your javascript for displaying the time, all you do is use PHP to set the starting time for your script. Something like this:

*************************
<?PHP
$mon = date("m"); //If you feel like providing the date as well
$day = date("d");
$year = date("Y");

$sec = date("s");
$min = date("i");
$hour = date("G"); //G for 24 format, g for 12 format
?>
*************************

The above code will load the date&time info from your server into variables. Once you know the time your server is set to, you can adjust to provide the time you want.
To pass the date&time information to the javascript you adjust the javascript variable with the php info, for example:

if your javascript looks like this:
timeToUse="12:00:00";

You change it with:
timeToUse="<?PHP echo $hour . ":" . $min . ":" . $sec ?>";


Is this helping you?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
weikelbobAuthor Commented:
Everything went well with the javascript, but I am having trouble with the PHP.



Here's the code so far (from Dreamweaver)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Bio-Med Proofreading, a Leading edge English Language Proofreading Company</title>



<script language="JavaScript" type="text/JavaScript">
<!--

function clock(){
d = new Date();
day = d.getDay();
mon = d.getMonth();
date = d.getDate();
year = d.getFullYear();
hr = d.getHours();
min = d.getMinutes();
sec = d.getSeconds();

if(hr==0){ap=" AM";hr=12}
else if(hr <= 11){ap=" AM"}
else if(hr == 12){ap=" PM";hr=12}
else if(hr >= 13){ap=" PM";hr-=12}

if(min <= 9){min="0"+min}
if(sec <= 9){sec="0"+sec}

zday=new Array();
zday=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
zmon=new Array();
zmon=["January","February","March","April","May","June","July","August","September","October","November","December"];

document.getElementById("clockDiv").innerHTML=" "+zday[day]+", "+zmon[mon]+" "+date+", "+year+" "+hr+":"+min+":"+sec+ap+""
}




function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_controlSound(x, _sndObj, sndFile) { //v3.0
  var i, method = "", sndObj = eval(_sndObj);
  if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = "play";
    else {
      if (window.MM_WMP == null) {
        window.MM_WMP = false;
        for(i in sndObj) if (i == "ActiveMovie") {
          window.MM_WMP = true; break;
      } }
      if (window.MM_WMP) method = "play";
      else if (sndObj.FileName) method = "run";
  } }
  if (method) eval(_sndObj+"."+method+"()");
  else window.location = sndFile;
}
//-->
</script>
<style type="text/css">
<!--
a:link {
      color: #0000CC;
}
a:visited {
      color: #0000CC;
}
a:hover {
      color: #000000;
}
a:active {
      color: #000000;
}
.style3 {
      font-family: Arial;
      font-size: 14px;
}
body {
      background-image: url(background/tan-stitched.gif);
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
.style11 {color: #666666; font-weight: bold; font-size: 24px; font-style: italic; font-family: Arial; }
.style17 {color: #333333}
.style25 {      font-family: Verdana;
      font-weight: bold;
}
.style26 {
      font-size: 9px;
      font-weight: bold;
}
.style28 {color: #000000}
.style29 {font-size: 24px}
.style29 {font-style: italic; color: #000000; font-weight: bold;}
.style30 {      font-family: Verdana;
      font-size: 14px;
}
-->
</style></head>

<body onload="clock();setInterval('clock()',1000)">



<?PHP
$mon = date("m"); //If you feel like providing the date as well
$day = date("d");
$year = date("Y");

$sec = date("s");
$min = date("i");
$hour = date("g"); //G for 24 format, g for 12 format
?>




<table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center"><img src="header/header2.jpg" width="780" height="125" border="0"></div></td>
  </tr>
</table>
<table width="95%"  border="0" align="center" cellpadding="0" cellspacing="2">
  <tr>
    <td width="32%" rowspan="2" valign="top"><div align="center">
      <table width="100%"
    border="0" cellspacing="0" cellpadding="20">
        <tr>
          <td height="42" valign="top" ><h2 align="center"><span class="style30">This is our time, Pacfic Standard Time, USA: </span>
            </h2>
              <div id="clockDiv">
                <h2>&nbsp;</h2>
            </div></td>
        </tr>
      </table>
      <p><img src="menu/service.gif" width="213" height="267" border="0" align="top" usemap="#Map">
              <map name="Map">
                <area shape="rect" coords="25,209,191,234" href="samples.html">
                <area shape="rect" coords="26,29,192,54" href="index.html" onMouseOver="MM_controlSound('play','document.CS1101967393937','file:///C|/Documents%20and%20Settings/Owner/My%20Documents/My%20Music/From%20Internet/tick2.wav')">
                <area shape="rect" coords="25,65,191,90" href="service.html">
                <area shape="rect" coords="25,139,191,164" href="turnaround.html">
                <area shape="rect" coords="25,176,191,201" href="privacyguarantee.html">
                <area shape="rect" coords="24,101,190,126" href="price.html">
              </map>
        </p>
    </div></td>
    <td width="68%" height="63" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="60" valign="top"><pre class="style3"><span class="style11"><span class="style28"><img src="images/2.gif" width="40" height="40" align="absbottom"><span class="style29">   Our Services</span></span><span class="style17 style28"></span><span class="style17">
<img src="images/BLUE-BAR.gif" width="250" height="3"></span></span></pre>
          </td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td><div align="left">
        <p style="line-height: 150%"><span class="style3">BioMed Proofreading is a leading English language proofreading company located in the USA, focused on biomedical manuscripts, and made up of medical and life science professionals who are also authors and referees for peer-reviewed biomedical journals. All members of our staff hold either a PhD, MD, or both degrees, and are all native English speakers. Our goal is to provide competent professional English proofreading and editing services for biomedical researchers and clinical doctors around the world who are not native English speakers. Our services are fast, convenient (available seven days a week, 18-hour on-line response every day), accurate, affordable, and easy to use. We provide you with a competitive advantage, because our professional editors know how to structure your scientific manuscript so that your research will have the maximum impact. We check through the text, and make correctio<img src="images/doctor3-jpg.gif" width="133" height="200" align="right">ns or accurate revisions with attention to errors of grammar, spelling, punctuation, capitalization, inaccurate terms, consistency, logic of presentation, English usage, style and even spacing, in either British English or American English. In addition, we have the expertise to provide authors with practical comments on how to write more successful research manuscripts &nbsp;(<a href="samples.html">Seeing is believing</a>). In one word, you write it, we finish it.</span></p>
    </div></td>
  </tr>
</table>
<table width="95%"  border="0" align="center" cellpadding="0" cellspacing="20">
  <tr>
    <td><P align="center" class="style25">&nbsp;</P>
        <P align="center" class="style25">CONTACT US:</P>
        <div align="center">
          <pre align="center"><FONT face="Arial, Helvetica" size=2>For questions regarding our services and manuscript submission: <FONT
face=Arial color=#000099><A
href="mailto:info@bmp-us.net">info@bmp-us.net</A></FONT><FONT
face=Arial>.</FONT></font>
<FONT
face="Arial, Helvetica" size=2>For question regarding payment: <A
href="mailto:biomed@bmp-us.net">biomed@bmp-us.net</A>.</font><FONT size=2> </FONT>
<FONT face=Arial size=2>Fax: 1-801-858-7952.
</FONT><FONT face="Arial, Helvetica" size=2>Mail address:<B><I> BioMed Proofreading,</I></B> P.O. Box 606041, Cleveland, Ohio 44106-9998, USA
.
</FONT><span class="style26" style="font-family: Arial"><A name="Certificate Number">Certificate Number</A>: 1383229, State of Ohio, United States of America
Copyright (C) 2003-2004, BioMed Proofreading. All rights reserved.</span></pre>
      </div></td>
  </tr>
</table>
<EMBED NAME='CS1101967393937' SRC='file:///C|/Documents%20and%20Settings/Owner/My%20Documents/My%20Music/From%20Internet/tick2.wav' LOOP=false
AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0></EMBED>
</body>
</html>
0
weikelbobAuthor Commented:
The Javascript works great, I'm going to change this over to the php topic area.

Thank you,

Bob
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.