hi all,
for ages now, iv'e used date(); to format the date and time the way i like it and its been fine, however, my site is hosted on a server that resides in the US and uses the PDT (i think) timezone. I am in london UK and use the GMT timezone so the server time is 8 hours behind me.
i have thought about just editing some code to add the 8 hours on, but if its 2am my time, its going to be 6pm on the server, but the previous day, which is too much hassling about. is there a way i can fix this problem? ive tried putenv() to set the timezone, ive tried setlocale() too and tried gmdate() too. all of which dont help.
for the past few hours, ive been working on a file to try to correct this problem, heres the code ive been using:
<?php
// at time of testing file in browser, it is
// 30th september 2003, 11:59PM on my machine
// my timezone is GMT and i am in london
putenv("TZ=GMT");
function br() {
echo "<br>";
}
// Attempt #01
// displays Tuesday 30 September 2003, 03:58 PM, PDT
// setlocale (LC_TIME, 'gbr');
setlocale( LC_ALL, "English" );
$datetime_0 = strftime("%A %e %B %Y, %I:%M %p, %Z");
echo $datetime_0;
br();
// Attempt #02
// displays Tuesday 30th September 2003, 3:58 PM, PDT
$datetime_1 = date("l jS F Y, g:i A, T");
echo $datetime_1;
br();
// Attempt #03
// displays Tuesday 30th September 2003, 10:58 PM, GMT
// only 1 hour out!!!
$datetime_2 = gmdate("l jS F Y, g:i A, T");
echo $datetime_2;
br();
?>
any ideas greatly appreciated