Page 1 of 1
Help with time zone in php code?
Posted: Wed Oct 15, 2008 11:11 am
by me666
Hey.... ive used this code to the the current date and time to a table when you login using my script....
Code: Select all
$todaydate = date('F j, Y - h:i A');
All works fine, the date and time are added as should, BUT the time is an hour erlier than i want it to be, so if u login at 3:30pm it saves it as 2:30pm... Is there a piece of code any1 knows that would alow me to change the timezone so it represents the correct time i want?
Thanks alot for any help any1 can give me

Re: Help with time zone in php code?
Posted: Wed Oct 15, 2008 11:15 am
by aceconcepts
Never used it before, but looks interesting:
http://uk.php.net/localtime
Re: Help with time zone in php code?
Posted: Wed Oct 15, 2008 12:03 pm
by me666
ahh thanks, that helped me a little but not much to be honest.... i have realized that the timezone in my script is correct, but its just not displayingit as daylight savings, therefor making it an hour early, but come next month when the clocks go back it will be the correct time, if u get what i mean... so now im looking for a script to determin if its daylight savings or not, is there a way of doing that?
thanks

Re: Help with time zone in php code?
Posted: Sun Oct 19, 2008 6:46 am
by Weirdan
what does the following show:
Code: Select all
var_dump(date_default_timezone_get());
Re: Help with time zone in php code?
Posted: Sun Oct 19, 2008 8:31 am
by me666
i get this error...
Fatal error: Call to undefined function: date_default_timezone_get()
thanks
Re: Help with time zone in php code?
Posted: Sun Oct 19, 2008 3:02 pm
by Weirdan
Then you must be having really old and rusty php... still on php4 by any chance?
Re: Help with time zone in php code?
Posted: Mon Oct 20, 2008 4:46 am
by me666
to be honest im not sure :S i use an online server and alot of my code was orriginally from templates. thanks for the help anyways... i will just have to change it myself when dst comes in and goes out, i have it running no problem just have to ad a little code to change the time back 1 hour, and remove it when dst is over so it is corrdct, if that makes sence. It will do as it it

thanks agen for the help
Re: Help with time zone in php code?
Posted: Mon Oct 20, 2008 4:49 am
by me666
yea, just looked at my servers website and the php version is 4.4.1
Re: Help with time zone in php code?
Posted: Mon Oct 20, 2008 2:02 pm
by Weirdan
me666 wrote:yea, just looked at my servers website and the php version is 4.4.1
Shame on your host for not updating in time... 4.4.1 is almost 3 years old.
Re: Help with time zone in php code?
Posted: Mon Oct 20, 2008 2:32 pm
by me666
yea thats the free account wich i use, the paid account is 5. something