Hi all.

In page.tpl.php, I have the following working code to implement a static time and date stamp:

	<div id="date-stamp">
		<?php print date('l, F jS g:i A') ?>
	</div>

First off, I am not sure this was the best way to implement this. It works, but if there is a better way, I'd like to know.

Next, how do I dynamically update this (say every minute)? (I wonder if it is even worth it, and perhaps I should only display the date?)

Thanks in advanced,

Dan

Comments

webdrips’s picture

Any ideas

Looking to Migrate from Drupal 6/7 to Drupal 10/11? Have a look at our Drupal 11 demo site and request access.

SteveTurnbull-1’s picture

Sounds like a job for jQuery -- basically you need to create a text string of the date and insert it into the div you've created. But it's a Javascript thing, in which case you can probably do it elegantly with jQuery. However I have no specific idea how.

You could get the page to refresh every minute which is a bit icky but it would work.

Yonyilsonyee’s picture

waaaaaaaaaaaaaaaaaaa

flevour’s picture

Check out http://jquery.jclock.js.googlepages.com/jclock.html for fine examples of running "live" clocks.
Cheers,
flevour
---------------------------
http://flevour.net