Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Julian Day
#10
(Oct-08-2016, 04:11 AM)Skaperen Wrote:
(Oct-08-2016, 01:41 AM)sparkz_alot Wrote: I'm thinking the simple solution would be to take the absolute value of year, then its a matter of ignoring leap years for that time period. I'll have to give it a try over the weekend, perhaps.

don't forget that 45, 42, 39, 36, 33, 30, 27, 24, 21, 18, 15, 12 and 9 BC are leap years and 4 BC, 0, and 4 AD are not. then leap years are every 4 years until whatever year the transition from Julian to Gregorian was adopted where you are.  are you doing proleptic Gregorian?

what if i entered 1752 for the year, and 9 for September, and a date of 3.  would it reject that date?

i worked out another system that is even more accurate and also simpler, but they would never adopt it.  for it to work, it would have to be adopted before 2028.

now how can someone use this code in their GUI programs?

If you input the date, 1752-9-3 at 1200 hrs, you get a JD of 2361211.0, which jives with US Naval Observatory. As to the years prior to 1752 (though there appears to be some debate on this year) at least from year 8 AD a leap year was every 4 years...period. 
again though, this snag only applies to testing the user input, the formula itself (if given the correct information) is quite accurate.

Quote:i worked out another system that is even more accurate and also simpler, but they would never adopt it.  for it to work, it would have to be adopted before 2028.
 It would be interesting to see.  And you never know, the international committee has been known to adapt  :D

Quote:now how can someone use this code in their GUI programs?

Probably so, but not by me  :D  .
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition


Messages In This Thread
Julian Day - by sparkz_alot - Oct-06-2016, 03:39 PM
RE: Julian Day - by j.crater - Oct-06-2016, 06:15 PM
RE: Julian Day - by sparkz_alot - Oct-06-2016, 08:34 PM
RE: Julian Day - by j.crater - Oct-06-2016, 08:38 PM
RE: Julian Day - by Skaperen - Oct-07-2016, 04:17 AM
RE: Julian Day - by sparkz_alot - Oct-07-2016, 02:25 PM
RE: Julian Day - by Skaperen - Oct-08-2016, 01:05 AM
RE: Julian Day - by sparkz_alot - Oct-08-2016, 01:41 AM
RE: Julian Day - by Skaperen - Oct-08-2016, 04:11 AM
RE: Julian Day - by sparkz_alot - Oct-08-2016, 02:09 PM
RE: Julian Day - by Skaperen - Oct-09-2016, 02:27 AM
RE: Julian Day - by sparkz_alot - Oct-09-2016, 02:37 PM
RE: Julian Day - by Skaperen - Oct-10-2016, 02:27 AM
RE: Julian Day - by sparkz_alot - Oct-12-2016, 04:42 PM
RE: Julian Day - by Skaperen - Oct-13-2016, 03:32 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020