Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
October 20, 2014, 03:27:05 AM

Pages: [1]   Go Down
  Print  
Author Topic: Showing the time  (Read 2374 times)
stephan
Guest
« on: July 23, 2001, 07:54:00 PM »

Hi, I wonder if you could help me?

I was trying to display the time on my page. I can show pacific time, but I'd like to show the uk time.

Every script I've tried has done it wrong!

It would be good if it could adjust itself to Summertime and normal time.

Thanks!

I hope you know how to do it...
Logged
Pug
Spaceship Captain
*****
Offline Offline

Posts: 105


WWW
« Reply #1 on: July 24, 2001, 06:47:00 AM »

I found a javascript clock on DynamicDrive I don't know if it's what you're looking for, as you posted here and not in the javascript forum.
It basically takes the time from the end user's system clock (and so relies on that being correct) but this should give it the right timezone if this is the object of the exercise.

If not, sorry, ignore the above.  
Logged

stephan
Guest
« Reply #2 on: July 24, 2001, 07:28:00 AM »

I meant in PHP    

It's going to be put into a chat room so that every message has the time displayed on it. I can do it in Pacific time, but my site is in the UK (and 99% of the visitors are too)

Thanks for looking it up though.  

[ July 24, 2001: Message edited by: Stephan ]
Logged
Gonzo
Trekkie
**
Offline Offline

Posts: 19


WWW
« Reply #3 on: July 24, 2001, 10:27:00 AM »

Have a look here ya might find something that you could use.
 http://www.php.net/manual/en/ref.datetime.php
Logged

stephan
Guest
« Reply #4 on: July 24, 2001, 08:24:00 PM »

Thanks.

I got it sorted. It was just the time difference that made it harder.

Here is the code.

<?
$hourdiff = "15"; // hours difference between server time and local time
$timeadjust = ($hourdiff * 60 * 60);
$correctdate = date("l, d F Y h:i a",time() + $timeadjust);
print ("$correctdate");
?>
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: