ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Clock display (live)

August 26, 2010 11:35am

Subscribe [2]
  • #1 / Aug 26, 2010 11:35am

    Scott Harrington

    85 posts

    Hi all, I have placed a nice neat plain text date and time feature in the top right of a website I’m working on using the markup below and in EE2..

    {current_time format="%g:%i:%s | %d.%m.%Y"}

    However, the output is static and just displays the time as you land whereas I would like it live, ie ticking away whilst on the page!

    I would like to keep it nice and clean using the EE mark up and was wondering if there was any alternative way of having the display as live?

    Any help would be appreciated

  • #2 / Aug 26, 2010 12:00pm

    John Ryan

    51 posts

    You’d need to use javascript for this - because it will run on the browser or client side and continually update the time.

    EE runs on the server, so it can only update the time once - when it sends it to the browser. Hence, the time displayed is when you landed on the page.

    A quick Google for javascript clock should provide you with a straightforward solution.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases