Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Location
    USA
    Posts
    364
    Thanks
    12
    Thanked 6 Times in 6 Posts

    modification of time format

    Hello,
    This should be simple:
    How do i modify the javascript to display the time in the same format the the "echo date" part? (php g:i:s A)

    PHP Code:
    <html>
    <head>
    <title>Dynamic Time</title>
    <script type="text/javascript">
    <!--
    servertime = <?= time() ?>;
    usertime = new Date();
    useroffset = servertime - usertime;

    function showtime(){
    d=new Date(Number(new Date())+useroffset);
    document.getElementById("dyntime").innerHTML=d;
    }
    //-->
    </script>
    </head>

    <body onload="setInterval('showtime()',250)">

    <span id="dyntime">
    <?
    echo date('g:i:s A <\a\c\r\o\n\y\m \t\i\t\le=\"\P\a\c\i\f\i\c \S\t\a\n\d\a\r\d \T\i\m\e (-0800)\">[\P\S\T]</\a\c\r\o\n\y\m>'time() - (7200));
    ?>
    </span>

    </body>
    </html>
    I found this script here and modified it a little bit.

    Thanks

    [edit] problem solved! (i used a different script) thanks if you tried to help
    Last edited by qwertyuiop; 04-18-2005 at 03:01 AM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •