Last night (before I went to bed, which was really this morning
), I got my CC image page to force nighttime icons!
What I managed to do was add a second source into the XML parsing algorithm to grab Wunderground's almanac data, and from using the sunrise, sunset, and the current times, I could make the script determine whether or not it's day or night. These are the variables I used:
It's nighttime if...
- the sunrise time is greater than the current time or..
- the sunset time is less than the current time
It's daytime if...
- the current time is greater than the sunrise time or..
- the current time is less than the sunset time
There is a glitch
that I cannot fix, however, that for some odd reason, when it hits midnight at any given location in their local time zone, for that hour, the daytime icons come out.
Anyways, sorry for the long post (tl;dr?).. but I thought I would share with you guys since it literally took like 4-5 hours for me to get this perfect in determining the time frames to use. No joke!
Here's two comparison images I have attached, and the link to access the CC page on my server is located in my sig.. just change to your location of choice though after the '='.