Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder ahayzen's Avatar
    Join Date
    Jun 2009
    Posts
    110
    Thanks
    8
    Thanked 11 Times in 11 Posts

    Sunrise Sunset not changing to daylight saving

    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?
    Code:
    echo(date_sunrise(time(),SUNFUNCS_RET_STRING,51.36,0.5));
    Thanks in advance

    Andy
    Last edited by ahayzen; 03-30-2010 at 03:23 PM.

  • #2
    Regular Coder xconspirisist's Avatar
    Join Date
    Jun 2006
    Location
    Great Britain.
    Posts
    138
    Thanks
    1
    Thanked 6 Times in 6 Posts
    Have you tried using date_default_timezone_set?

    http://uk2.php.net/manual/en/functio...mezone-set.php

    It looks like your script is only tollerant with a single timezone, so that function may be appropriate for you.
    If I have been helpful, use the "thank" button - It makes me happy!

    xconspirisist.co.uk - homepage of my online alias
    technowax.net - a community for people interested in all forms of modern technology.

  • #3
    Regular Coder ahayzen's Avatar
    Join Date
    Jun 2009
    Posts
    110
    Thanks
    8
    Thanked 11 Times in 11 Posts
    Thankyou for the quick reply. I tried using the code below.
    Code:
    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?

  • #4
    Regular Coder xconspirisist's Avatar
    Join Date
    Jun 2006
    Location
    Great Britain.
    Posts
    138
    Thanks
    1
    Thanked 6 Times in 6 Posts
    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.
    If I have been helpful, use the "thank" button - It makes me happy!

    xconspirisist.co.uk - homepage of my online alias
    technowax.net - a community for people interested in all forms of modern technology.

  • Users who have thanked xconspirisist for this post:

    ahayzen (03-30-2010)

  • #5
    Regular Coder ahayzen's Avatar
    Join Date
    Jun 2009
    Posts
    110
    Thanks
    8
    Thanked 11 Times in 11 Posts
    Fixed somehow.
    PHP Code:
    echo(date_sunrise(time(date_default_timezone_set('Europe/London')),SUNFUNCS_RET_STRING,51.36,0.5)); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •