...

View Full Version : Resolved Sunrise Sunset not changing to daylight saving



ahayzen
03-30-2010, 01:50 PM
I have a sunrise sunset times on my website using the code below. However now we have gone into daylight saving the times are 1 hour out. Is there a way that the php can change the time to +1 automatically?


echo(date_sunrise(time(),SUNFUNCS_RET_STRING,51.36,0.5));


Thanks in advance

Andy

xconspirisist
03-30-2010, 02:00 PM
Have you tried using date_default_timezone_set?

http://uk2.php.net/manual/en/function.date-default-timezone-set.php

It looks like your script is only tollerant with a single timezone, so that function may be appropriate for you.

ahayzen
03-30-2010, 02:06 PM
Thankyou for the quick reply. I tried using the code below.


echo(date_sunrise(date_default_timezone_set('Europe/London'),SUNFUNCS_RET_STRING,51.36,0.5));

However it seems to be saying that the sun should rise at 9:00 and set at 17:00. Which is defiantly wrong. What have I done wrong with the code?

xconspirisist
03-30-2010, 02:15 PM
Ah. Well I intended to use the code on a separate line, above your example. Although I must be honest I am completely unfamiliar with the sun related functions. If you are just trying to differentiate between BST and UTC, you just need to use that timezone function.

ahayzen
03-30-2010, 02:20 PM
Fixed somehow.


echo(date_sunrise(time(date_default_timezone_set('Europe/London')),SUNFUNCS_RET_STRING,51.36,0.5));



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum