WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Create a true clock (5 posts)

  1. icco
    Member
    Posted 7 years ago #

    I want there to be an actual clock on my webpage. I figured out the basic php to get the local time for the reader and or th server time. but what i really need is a way for this to keep updating (maybe AJAX or something?) with out reloading the page. the final product would a small digital clock on the side of the page.

    I am making a small plugin out of this just so the code is easily maintainable

    inside the plugin is the following

    function nattime() {
    $now = localtime( );
    print "$now[2]:$now[1]:$now[0]
    ";
    }

    and in my page
    <div class="blox">

    The Time is Currently
    <?php nattime() ?>
    </div>

    any help to make the time update more frequently then a full page refresh would be helpful

  2. vkaryl
    Member
    Posted 7 years ago #

    Lots of scripts out there for real time clocks. Try some of the script sites. Why reinvent the wheel?

    Actually, I think Viper might have a plugin for you:

    http://www.viper007bond.com/wordpress-plugins/flash-clock-widgets-for-wp-dash/

  3. icco
    Member
    Posted 7 years ago #

    aww. but reinventing the wheel is so fun. To be honest i just had trouble finding a good script that would work. Vipers plugin is sorta the idea i had but not really, i'll keep looking

  4. vkaryl
    Member
    Posted 7 years ago #

    Heh. Yeah, I understand that as far as it goes. I know I've seen some "constant-update" scripts on sites like dynamic drive and hotscripts.

    [Of course, if everyone is using a current OS of any sort, they all have a current realtime clock anyway....]

  5. icco
    Member
    Posted 7 years ago #

    ya, but this is mainly for me, when i am working or browsing the web i don't look at my clock, but if a clock is on the page i can realize if i need to stop.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags