title: Is there an algorithm for determining how much daylight there is?
body: <p>Is there a function/algorithm that allows me to input the latitude and the approximate orbital position of the earth in so that I can determine how long the sun is up?  IE during the winter it would show that the sun is only up a few hours in the far north hemisphere.</p>
  
  <p>I did some basic Google search and didn't find much so I was thinking that I might have to do some trigonometry that would allow me to calculate how much the earth is inclined or not toward the sun then use that information along with the latitude to figure out how much sunshine a site would be getting.</p>