Jump to content

Archived

This topic is now archived and is closed to further replies.

fruzzgle

Date

Recommended Posts

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).

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

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.

Share this post


Link to post
Share on other sites
That can only be done with Javascript.

Ken

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.