Web Hosting Forum | Lunarpages


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



Login with username, password and session length
May 25, 2012, 12:45:40 PM

Pages: [1]   Go Down
  Print  
Author Topic: Server Time offset to GMT  (Read 279 times)
chriswatson
Trekkie
**
Offline Offline

Posts: 16


WWW
« on: March 29, 2003, 04:52:00 PM »

Hi everyone, Just recently moved to Lunarpages and i love it !!!!

Anyway i need a little bit of help, I've got a number of PHP scripts running on my web sites that take the date and time from the web server to display but all the times are showing in PST.

I've emailed Lunarpages Support but they can only change the whole server so everyone would then be on GMT, (Dont think they'll do that).

Is there anyway to just change it for my hosting package ??? with something like a .htaccess file ??? or a PHP script to fool the server time ???

Otherwise it means getting my php scripts changed.

Any Help Please ?

Thanks for your help.

Regards
Chris.
 
 [ March 30, 2003, 03:52 AM: Message edited by: chriswatson ]
Logged
TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #1 on: March 29, 2003, 04:25:00 PM »

I'm thinking you will probably have to change your scripts.  It is a server variable, and I don't see how it could be changed without changing the actual time on the server.
Logged

"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site
stephan
Guest
« Reply #2 on: March 29, 2003, 04:53:00 PM »

Yeah, you have to add/subtract an amount of time from the scripts.

Some scripts have configuration files. Postnuke/PHPnuke let you change the time settings easily.
Logged
Stephanie®
Master Jedi
*****
Offline Offline

Posts: 1096



« Reply #3 on: March 29, 2003, 04:56:00 PM »

There's a little script for changing time zones in php that you may be able to add, I'll have a look later and see if I can find it.
It should adjust the time to +1 +2 etc..from PST.
Most servers are on their local time, and this is fixed.
Logged

chriswatson
Trekkie
**
Offline Offline

Posts: 16


WWW
« Reply #4 on: March 29, 2003, 06:39:00 PM »

Thanks for your FAST help,

Heres the line from my PHP page that calls the stored time from the mysql database-

echo "<tr><td bgcolor=\"$this->colour\">",$this->d->id,"<td bgcolor=\"$this->colour\">",date("d/m/Y H:i:s",$this->d->time)," ";

The time is 9 hours out, what would i need to change so the time displayed is +9 hours.

Thanks again for the great support here.

Regards
Chris.
Logged
stephan
Guest
« Reply #5 on: March 29, 2003, 07:16:00 PM »

Here's a quick example of how alter the time:

 
code:
 <?php

// Script copyright (C) 2000 Dean Kennedy (dean@terrabyte.dc.com.au)
// Version 1.0   23 October 2000
// Free to use, modify and copy so long as you leave my name in comments

// Distributed under the terms of the GNU General Public License (GPL).
// Because it is licensed free of charge, there is NO WARRANTY, it is
// provided AS IS. The author can not be held liable for any damage that
// might arise from the use of this software. Use it at your own risk.
// http://www.gnu.org/copyleft/gpl.html

// To adjust the format of the date, see the list of variables at the
// official PHP site (php.net): http://www.php.net/manual/function.date.php
//
// If your local time is *behind* the server time, then change the "+" to
// a "-" in the $melbdate line
//
// Keep in mind that you'll have to update the $hourdiff variable within the
// script when your *local* daylight saving time/standard time changes, if
// it is a different setting to the server daylight saving/standard time

// Variable for hours

$hourdiff = "16"; // hours difference between server time and local time

// If you don't know how many hours, then "uncomment" the three lines
// below by deleting "// " to see what the server time is (remember to
// put the comments "// " back when you've finished checking:

// $serverdate = date("l, d F Y h:i a");
// print ("$serverdate");
// print (" &nbsp; <p>");

// Nothing needs to be changed below here unless you want to change
// the format of the date (see above for URL of options) or your local
// time is behind the server time

$timeadjust = ($hourdiff * 60 * 60);

$melbdate = date("l, d F Y h:i a",time() + $timeadjust);

print ("$melbdate");

?>
 

Logged
chriswatson
Trekkie
**
Offline Offline

Posts: 16


WWW
« Reply #6 on: March 30, 2003, 03:25:00 PM »

Thanks for all your help , sorted it now. Just used part of the code above.

Thanks
Chris.  "[Big
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: