Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.



How to calculate sunrise and sunset times yourself

Recommended Posts

Hi everyone,

I recently made a tutorial which (hopefully) encompasses everything you need to know about manually calculating sunrise and sunset times yourself. It is available as a walk-through tutorial with mathematical functions explained here:

How to calculate sunrise and sunset times

I also turned it into a C++ program which provides sunrise and sunset times (in UTC, with the option of DST) in case you want to check the answers, and also basic ephemerides for the Sun. It only takes about 200 lines of code to implement this algorithm yourself, so you could use this tutorial to make your own program too.


The link above might not always be available, so if you find it dead, please contact me if you want the program.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.