Last night (before I went to bed, which was really this morning
![tongue :P](https://twctodayforums.com/forums/Smileys/1/tongue2.gif)
), I got my CC image page to force nighttime icons!
![Dancing :dance:](https://twctodayforums.com/forums/Smileys/1/dancing4dh.gif)
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.
![Hmm... :hmm:](https://twctodayforums.com/forums/Smileys/1/hmm.png)
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!
![ko3 :wacko:](https://twctodayforums.com/forums/Smileys/1/ko3.gif)
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 '='.
![thumbsup :thumbsup:](https://twctodayforums.com/forums/Smileys/1/thumbsup.gif)