Equinox and Solstice Calculation


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

Environment: VC6

Here is a little programme I wrote to calculate the date and time of equinoxes and solstices in a given year (not earlier than 4713 BC). Actually I am no astronomer: I have only collected information on calendars and astronomical calculations from various sources on the Internet and assembled what I needed.

The included public domain time routine converts Julian Day Numbers to Gregorian and Julian calendar dates. Julian Day Numbers (JDN) are used by astronomers as a date/time measure independent of calendars and convenient for computing the elapsed time between dates. The JDN for any date/time is the number of days (including fractional days) elapsed since noon, 1 Jan 4713 BC. Julian Day Numbers were originated by Joseph Scaliger in 1582 and named after his father Julius, not after Julius Caesar. They are not related to the Julian calendar.

Years BC are given as negative numbers. Note that there is no year 0 BC; the day before 1 Jan 1 AD is 31 Dec 1 BC. Note also that 1 BC, 5 BC, etc. are leap years.

Pope Gregory XIII decreed that the Julian calendar would end on 4 Oct 1582 AD and that the next day would be 15 Oct 1582 in the Gregorian Calendar. The only other change is that centesimal years (years ending in 00) would no longer be leap years unless divisible by 400. Britain and its possessions and colonies continued to use the Julian calendar up until 2 Sep 1752, when the next day became 14 Sep 1752 in the Gregorian Calendar. This routine can be compiled to use either convention. By default, as I am Italian and Roman Catholic, Pope Gregory's convention is used. Simply comment out

#define PAPAL
to use British convention.

This programme uses formulae taken from Jean Meeus's "Astronomical Algorithms" (1991). CalculateDate() function is based on formulae originally posted by Tom Van Flandern Washington, DC metares@well.sf.ca.us in the UseNet newsgroup sci.astro. Reposted 14 May 1991 in FidoNet C Echo conference by Paul Schlyter (Stockholm). Minor corrections and additional information on JDNs and calendars by Raymond Gardner Englewood, Colorado.


Download demo project - 136 kB


  • The 11 second question

    Posted by Wesley Jones on 03/01/2018 02:43am

    Question: I am not competent in calendar computations but know just enough to ask whether this tool takes into account the extra 11 seconds that add up over 500 to make an extra day? My concern is of course that in the short term we do not notice, but for the purpose of spanning thousands of years we would be off by 2 days per millennia.

  • Is there a Visual Basic version for this?

    Posted by RAG2 on 11/23/2009 07:07am

    I'd find "Equinox and Solstice" calculation very useful, but I have VB6 and VB 2008, not VC6. Is there a Visual Basic version of the season-calculating algorithm? How difficult is it to convert it to VB?

  • Excelllent!

    Posted by Legacy on 12/21/2003 08:00am

    Originally posted by: coderInCa


    Thank you.

    • Nothing

      Posted by karthi58 on 07/07/2009 01:19am

      nothing to reply

  • Wel done !

    Posted by Legacy on 07/19/2003 07:00am

    Originally posted by: sabit

    Wel done,

  • i got question for calculating time...

    Posted by Legacy on 05/20/2003 07:00am

    Originally posted by: Li

    do you have any program for initialize the time start from zero. eg: (00:00:00), then after press the "start" button, it will start counting the time by second.

    plz send the example to my email.
    thanks in advance.

    my email: zgleelee@yahoo.com

  • Whatever!

    Posted by Legacy on 07/21/2002 07:00am

    Originally posted by: Carol

    Great work - Now can we please have 2003!

  • Thank you!

    Posted by Legacy on 07/11/2002 07:00am

    Originally posted by: Mike

    Thank you so much for sharing your work. My limited understanding of C++ was sufficient to allow me to adapt your code to a DLL that was easily accesible to my Visual Basic calendar program. You saved me hours of work.

  • Seasons

    Posted by Legacy on 06/19/2002 07:00am

    Originally posted by: Paul Stevenson

    The calculator is great but as someone from the Southern Hemisphere all the labels are backward for us down here. It would be less "northern-hemispherocentric" if qualified by a note to the effect that it was for your hemisphere. On Friday we will celebrate mid-winters day on your summer solstice.

  • 15 minutes approximation

    Posted by Legacy on 01/09/2002 08:00am

    Originally posted by: Vernero Cifagni

    As you may have seen in the source files, the CalculateDate() conversion routine is intrinsically accurate to only about 15 minutes for years around 2000 CE. I think it might depend on the algorithm itself. Maybe it has something to do with the fact that the times calculated by this programme are ephemeris times (see http://infoplease.com/ce5/CE017077.html). To get an estimate of GMT to within about fifteen minutes adjust by the appropriate value of delta-T (which is currently about one minute, so no modification is needed for years in the 20th or 21st centuries - see http://user.online.be/felixverbelen/dt.htm). For dates around 1 CE actual times GMT may have been about three hours earlier than the times given.
    I admit I lack information on how to avoid these inaccuracies. Any suggestions will be, of course, welcome.

  • Brilliant!

    Posted by Legacy on 01/08/2002 08:00am

    Originally posted by: Franco Gerevini

    Nice job! Franco

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date