Prolog Get the differences in days between two dates -
i've been trying compare 2 dates in prolog.
the dates format date(yyyy, mm, dd)
ex: (2016,04,21).
i want compare 2 dates , know if difference (in days) between dates bigger 15 days (2 weeks).
%datedifference( number_of_day, date_no1, date_no2 ). datedifference( 35, date(2003,8,16), date(2003,9,20) ).
computing difference in days between 2 dates can simple or tricky depending on calendar , on covered periods. assuming gregorian calendar, common solution convert dates julian days. @mat mentioned in comment, swi-prolog, consider library(julian)
;
https://github.com/mndrix/julian
for portable solution can used prolog systems (including swi-prolog), logtalk includes third-party iso 8601 library can used these computations:
Comments
Post a Comment