Page 1 of 1

date code not working correctly

Posted: Tue Dec 06, 2005 12:20 pm
by ericburnard
i am using this code

Code: Select all

date('d/m/Y :: [G]');
for my date and time and instead of getting the correct time i am getting one 8 hours earlier.
What can i do to make it show thie time on my computer.

(my site is http://www.madashatters.com is you want to look at the date on the blog entry. it was actually posted at 6.12 pm)

thanks
Eric

Posted: Tue Dec 06, 2005 12:20 pm
by hawleyjr
Sounds like the date on your server is different than your local time.

Posted: Tue Dec 06, 2005 12:24 pm
by ericburnard
how can i change thAT to my time? can i?

eric

[EDIT] its not my server im hosted on ipowerweb

Posted: Tue Dec 06, 2005 12:26 pm
by Burrito

Code: Select all

date('d/m/Y :: [G]',strtotime("+ 8 hours"));

Posted: Tue Dec 06, 2005 12:30 pm
by ericburnard
ahhhh thank you very much :)

Posted: Tue Dec 06, 2005 12:41 pm
by hawleyjr
I would create a function or even better a constant value for the date difference.

This way you only have one place to change the date offset incase you change servers...

Posted: Tue Dec 06, 2005 12:48 pm
by Burrito
what you should do is create a "preferences" section so users can set their own time (zone) and have it calculate their local time automatically.

Posted: Tue Dec 06, 2005 5:06 pm
by ericburnard
well at the moment im just trying to get my site up an running but when thats done i wthink ill do the preferences thing to put in with my admin section etc.

Thanks again
Eric