Page 1 of 1

get_sunset() problems

Posted: Thu Oct 25, 2007 1:33 pm
by heritage
I am trying to use get_sunset function and having the following problems:

1. why when I use time() parameter it shows different result then when I use date('Y-m-d') ? Shouldn't sunset be the same time during the whole day??

2. I took the information for chicago from the reliable chart: $lat = 41.9897; $lng = -87.7014; but it doesn't show me the same result. I mean the minutes part is wrong, so offset has nothing to do with it. For example 2007-10-25 sunset should be 17:55, but I cannot get such time.

3. I tried using different zenith, but doesn't help.

Any ideas?

function or class

Posted: Thu Oct 25, 2007 2:45 pm
by churt
Are you perhaps referring to date_sunset?

Posted: Thu Oct 25, 2007 4:16 pm
by heritage
yes, you are right.
the rest of the message is correct :(


Posted: Tue Oct 30, 2007 2:55 pm
by churt
Sorry I did not get back sooner. Went on vacation and had no access to play with code.

It gets tricky using a date but just make sure that you preface all date references with strtotime().

This code worked fine for me.

Code: Select all

echo date_sunset(strtotime('2007-10-25 10:01'), SUNFUNCS_RET_STRING, 41.98, -87.90,90.83,-5);
When I use 41.9897 and -87.7014 I get 17:54. I could live with that but the ones I used above give me 17:55. I took them from Chicago/O'hare,IL.

I had issues using

Code: Select all

date('Y-m-d', '2007-10-25')
When I used

Code: Select all

strtotime(date('Y-m-d', strtotime('2007-10-25'))
it worked fine.

I then realized that was redundant and shortened it to

Code: Select all

Hope this helps.