PHP Code For Continuous Time Change including seconds

Discussion in 'HTML & Website Design' started by mahi_mukka, Aug 11, 2009.

  1. #1
    Dear All
    I have a piece of code written in php for time and date display funtion.

    <?php
    echo date('d-M-y H:i:s');
    ?>


    Output of the above code is 11-Aug-09 10:56:12

    I would like seconds to change continuously without refreshing the page.
    What are the modifications do i need to change.

    Thanks in advance.
     
    mahi_mukka, Aug 11, 2009 IP
  2. mahi_mukka

    mahi_mukka Peon

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    any replies will be appreciated...
     
    mahi_mukka, Aug 11, 2009 IP
  3. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #3
    Because PHP is server side, it will only update when you request the page. You need to use something like JavaScript to actually display the clock, and the ticking seconds.

    What I suggest you do, is get the correct time from your server using PHP, then use that to set the time on a JavaScript clock (with seconds).
     
    Kerosene, Aug 12, 2009 IP