Click to See Complete Forum and Search --> : Server time conversion to my local time
CodeGod
02-24-2004, 09:25 AM
hello all,
the server offset where my website is hosted is -06 I want to use my local offset +5 on several places.. can anyone tell me the code to do conversion and display the time in +5 GMT offset?
thank you!
jpmoriarty
02-24-2004, 02:10 PM
i've never worked out how to do a general offset - it's bloody inconvenient, but what i do is:
have an include file with:
$time_offset = 5;
$time_offset = $time_offset*60*60;
then include that file in every page.
then when you have a date / time, just change it to:
date("formatting",mktime()+$time_offset);
best i can offer i'm afraid.
CodeGod
02-24-2004, 03:39 PM
Thanks alot jpmoriarty!
I also found another way :)
echo date("h:i:s A", strtotime("+11 hours"));
where 11 is the difference between the server and my local timezone , and it also works fine without +.