Forum Moderators: coopster

Message Too Old, No Replies

Need help with script to adjust time to UK.

         

JustinDia

4:52 pm on May 9, 2004 (gmt 0)

10+ Year Member



Hi there,

My server is in the USA and I am in UK (7 hour difference) and I am not really sure how to fix this with PHP.

I am using this script but need the time ammendment incorporated:

<?php
$date = date("Ymd");
$NumEvents=0;
$handle=opendir('../event_dates');
while (($file = readdir($handle))!==false) {

if ($file >= $date) {
include("../event_dates/$file");
$NumEvents=$NumEvents + 1;
}
}
closedir($handle);

if($NumEvents > 0)
{
echo "$NumEvents events are scheduled";
}
else
{
echo "<strong class='red'>Sorry, no events are planned at present</strong>";
}

?>

and wondered if anyone could help me with changing the time to UK.

Thank you
Justin

yintercept

5:48 pm on May 9, 2004 (gmt 0)

10+ Year Member



My server is in the USA and I am in UK

Do you, by chance, live near a town named Greenwich? I would check to see if gmdate() is returning the correct time. If your hosts server is set up correctly, then you should be able to get all of your date information in GMT, then offset the information for your time zone.

dreamcatcher

5:49 pm on May 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi JustinDia,

I think the strtotime() function is what you might be looking for:

$date = date("D j M Y, G:ia", strtotime("-7 hours"));

echo $date;

JustinDia

7:09 pm on May 9, 2004 (gmt 0)

10+ Year Member



Thanks for the information :) I will try it!

About 70 miles from Greenwich!

Thank you