View Full Version : time question.
edward
07-17-2007, 07:17 PM
Whenever I use $time = date("g:i a"); The time is always 4 hours later.
For instance, lets say its 5:55, it will say 9:55.
What can I do to change this?
Tyler
07-17-2007, 07:30 PM
When you echo the date minus 4 hours from it. There are many time zones in the world and your obviously not in the same time zone as the server.
edward
07-17-2007, 07:37 PM
Can you tell me how to do that?
UnlimitedMB
07-17-2007, 07:58 PM
easiest way is to use gmdate (which always returns gmt time zone) and add or remove the number of hours you want. This way you get the same result no matter what server you use.
cr0wonline
07-18-2007, 09:48 PM
Or, you could use the function PHP made for timezones - date_default_timezone_set() (http://ca3.php.net/manual/en/function.date-default-timezone-set.php) ;)
UnlimitedMB
07-18-2007, 10:57 PM
Nice, i didnt know about that one.
But then i only look up functions as i need them, and i never needed to know the timezone for anything.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.