Jump to content


Photo

Date


  • Please log in to reply
4 replies to this topic

#1 fruzzgle

fruzzgle
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationKS City :]

Posted 29 May 2006 - 06:59 PM

This isn't much but I couldn't find anything that would show you the updated time without refreshing the browser. What I mean by this, I have the following code (very simple, this is just a test I'm doing after looking at a date tutorial).

<?php
echo(date("l h:i:s a"));
?>

This shows you the day of the week and the hour, minut, seconds and either am or pm .

Example: Monday 06:54:49 pm

But to see what time it is you need to refresh the page to see the updated time. How do I make it so you don't have to refresh and your see the time go

Monday 06:54:49 pm
Monday 06:54:50 pm
Monday 06:54:51 pm
Monday 06:54:52 pm

And so on. I explained it the best I could but if you don't know what I'm talking about I'll try to re-explain it.

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 29 May 2006 - 07:10 PM

That can only be done with Javascript.

Ken

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 29 May 2006 - 07:11 PM

If you want 'live' time on a page without refreshing, then you have to use javascript (or an applet). It can't be done with php. Google for "javascript clock" and you'll find hundreds of scripts that'll work.
Legend has it that reading the manual never killed anyone.
My site

#4 a1ias

a1ias
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 29 May 2006 - 07:13 PM

Hi fruzzgle

I'm pretty new to php myself and have been hunting down a good php resource site for a while - looks like I found one :)

Anyway, I see your post and notice that noone has replied as yet so I figure I'd have a bash myself. I've only been learning php for about 2 weeks now but I've not yet come across a way to do what you want without using Javascript.

Not sure if I'm allowed to post this so if not, an admin may remove it, but you could try [a href=\"http://www.dynamicdrive.com/dynamicindex6/index.html\" target=\"_blank\"]This[/a] link.

#5 fruzzgle

fruzzgle
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationKS City :]

Posted 29 May 2006 - 07:58 PM

Thanks for you help!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users