Last active
December 15, 2015 00:29
-
-
Save mndrix/5173377 to your computer and use it in GitHub Desktop.
Modified Julian Day calculations in Prolog. This experiment might form the basis of a date library someday.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- module(julian, [calendar/2]). | |
:- use_module(library(clpfd)). | |
calendar(datetime(MJD,_Nano), gregorian(Year, Month, Day)) :- | |
A #= (14-Month)/12, | |
Y #= Year + 4800 - A, | |
M #= Month + 12*A - 3, | |
MJD #= Day + (153*M+2)/5 + (Y*3652425/10000) - 2432046. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Find Fourth of July on a Sunday during Dwight Eisenhower's presidency: