Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End php date

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #30955
    allampatu
    Participant

    hi everybody

    i’m using this code to display date and time

    
    echo date ("l jS of F Y H:i:s", mktime (date("H")-8,date("i"))) ;
    ?>

    my simple question is how can i refresh the seconds every seconds?

    i searched for javascript or ajax solution but nothing good for me

    thanks

    #70084
    TheDoc
    Member
    #69959
    allampatu
    Participant

    i need it for wordpress

    i have already on body a tag onload()

    #69971
    Bob
    Member

    You can use the javascript file TheDoc linked to in wordpress as well I’m sure.

    Just upload the file to a directory on your website server. Then just the source to the right path:

    #66585
    gno
    Member

    If you want it to run a clock that updates every second, your answer is javascript – not PHP.

    PHP is a server side language – thus run on the server.

    Javascript is a client side language, and lets the users browser do the work.

    There is absolutely no point in making a clock ajax/php based. You are making a bunch of useless http requests, and the time would even jump several second intervals on poor connections.

    #66599
    creative
    Member

    I have use:

    Just change the city where live so that you can have it running at least minute by minute (not seconds)

    #66316
    dhechler
    Member

    TheDoc is right.
    http://www.dynamicdrive.com/dynamicindex6/clock2.htm

    Just include the javascript files in your header like so



    Then initialize it. It doesn’t have to be on your body tag.



    Hope that helps.

    #66259
    creative
    Member

    The javascript solution will show the computer’s time. Not the actual time. The php way, will show the actual time in the city.

    #66266
    noahgelman
    Participant

    Can you use PHP to get the time initially, and then use javascript to change the time

    #66242
    gno
    Member

    May I ask what you need the time for?

    I have a hard time figuring out what the purpose of the site would be, if the clock is a killer feature.

    Excuse me, but why is it interesting to the user? No matter what O/S you use, you will have a clock in your taskbar or whatever.

    Unless your remaking http://www.time.is it does not seem to be worth an effort ;-)

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘Back End’ is closed to new topics and replies.