0
$\begingroup$

I am making a watch app, where I need to know where there is currently sun, and where it's not.

I need to have some sort of formula/function to insert: date, time and longitude, and get back the latitude of the civil twilight.

How can I do this?

$\endgroup$
5
  • 1
    $\begingroup$ Could you maybe explain it a bit clearer? As far as I understand, you want to draw an area on the world map where there is currently civil twilight. But you must know that such area isn't a line, but is an area, so you would get inequation. The places in civil twilight have Sun between -6° and 0° of altitude. $\endgroup$
    – User123
    Jun 22 at 18:54
  • $\begingroup$ Yes, well, i dont really need it to be that specific. the worldmap is 200px x 100px, as it is going to be shown on a wristwatch. I just want to make something with this kind of effect, just way smaller: i.ytimg.com/vi/fDJrih_rAUc/maxresdefault.jpg $\endgroup$
    – patchie
    Jun 22 at 21:43
  • 1
    $\begingroup$ How will this factor in the height above sea level of the observer? It's still sunny on a mountaintop when the Sun has set for those on the plain... (I'm sure there's a deeper philosophical meaning here!). $\endgroup$ Jun 22 at 22:58
  • $\begingroup$ Related: astronomy.stackexchange.com/q/39670/16685 My answer there has Python code that calculates sunrise time, and it can be modified to compute sunset time, if you understand the Equation of Time. However, that code uses a very crude formula for the Sun's position, I have a more accurate formula here: astronomy.stackexchange.com/a/40243/16685 $\endgroup$
    – PM 2Ring
    Jun 23 at 3:06
  • $\begingroup$ BTW, calculating the exact time of sunrise, sunset, and the various twilights is tricky. As chappo mentioned, you need to take the local geography into account, and atmospheric refraction, which is rather large for celestial bodies near the horizon. $\endgroup$
    – PM 2Ring
    Jun 23 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.