Is it possible to get portable current_date(date(Y, M, D))?

SWI - specific implementation

current_date(date(Y, M, D)) :-

    get_time(T),

    stamp_date_time(T, date(Y, M, D, _, _, _, _, _, _), local).

Not compatible with GNU Prolog/SICStus… Each Prolog implementation seems to have their own Date/Time library and even date functor format.

Such is life :frowning: Ideally that should be standardized by ISO or the PIP initiative. Until then, your can use e.g., Logtalk as a portability layer or you can use

:- if(current_prolog_flag(version_data(swi(_,_,_,_)))).
<swi code>
:- elif(current_prolog_flag(version_data(gprolog(_,_,_,_)))).
<gnu code>
...
:- endif.

Or, traditionally, write a file for each Prolog system for everything you need that is not portable and load the right file for the system. Finally, you can use the portability layer of SWI-Prolog using expects_dialect/1. Note that the various dialect emulation libraries have been constructed on demand for certain applications. So, add what you need and send a pull request to get it into the distribution.