Did you know ... Search Documentation:
Pack julian -- prolog/julian.pl
PublicShow source
 datetime(?Datetime:datetime, ?MJD:positive_integer, ?Nano:positive_integer) is semidet
True if Datetime falls on modified Julian day MJD and occurs Nano nanoseconds after midnight.
 datetime(?Datetime) is semidet
True if Datetime is a datetime term.
 form_time(?Form, ?Datetime:datetime)[multifile]
True if Datetime can be described by Form. Form is a sugary representation of a set of datetimes. This predicate is the workhorse for converting between datetime values and other date representations. It's also the workhorse for further constraining a datetime value.

Here are some acceptable values of Form.

  • today - the set of all nanoseconds in the local day
  • now - the current nanosecond
  • dow(tuesday) - the set of all Tuesdays in history
  • dow([saturday,sunday]) - set of all weekends in history
  • weekday - like dow([monday,...,friday]) but faster
  • month(july) - the set of all Julys in history
  • month([june,july]) - the set of all Junes and Julys ever
  • unix(EpochSeconds) - floating point seconds since the Unix epoch
  • [foo,bar] - both foo and bar forms apply
  • gregorian(Year,Month,Day) - all seconds in a Gregorian date of the given form. For example, gregorian(_,3,_) represents the set of all the months of March in history.
  • Year-Month-Day - same as gregorian(Year,Month,Day)
  • Hours:Minutes:Seconds
  • midnight - shortcut for 00:00:00
  • noon - shortcut for 12:00:00
  • final_moment - shortcut for 23:59:59.99999999999999
  • after(Form) - all times after Form
  • before(Form) - all times before Form
  • future - alias for after(now)
  • past - alias for before(now)
  • rfc3339(Text) - the nanosecond indicated by the RFC 3339 date string. Text can be atom or codes or string.
  • nth(N,Form) - Nth day (1-based) that matches Form in the month. N can be a list of days in which case form_time/2 is multi. This form isn't yet as flexible in different modes as I'd like.
  • true - noop constraint that matches all dates
  • Datetime - a datetime itself can be used as a form
  • mjn(Mjn) - modified Julian nanoseconds

This predicate is multifile because other modules can support different calendars, different holiday schedules, extra sugar, etc.

 form_time(+Form) is semidet
True if a date exists which satisfies Form. For example, "is May 1, 1979 a Tuesday?" would be
form_time([1979-05-01,dow(tuesday)])
 findall_dates(+Dt:datetime, -Dts:list)
True if Dts is all individual days in the set Dt. Dts is in order from oldest to most recent.
 date(?Dt:datetime) is nondet
Assign a single date based on the constraints of Dt. This can be used to iterate all values of Dt.
 compare_time(+Order, ?A:datetime, ?B:datetime) is semidet
compare_time(-Order, ?A:datetime, ?B:datetime) is nondet
True if the chronological relation between A and B is described by Order. None of the arguments needs to be bound. When Order is not bound, compare_time/3 iterates all possible values of Order on backtracking. In other words, the relation is not stored as contraints on Order.

A and B can be given as datetime values or forms. For example, this is a legitimate goal:

compare_time(Order, now, unix(1375475330.414)).
 delta_time(?A:datetime, ?Delta:duration, ?B:datetime)
True if datetime A plus duration Delta equals datetime B. Delta is a compound term representing a duration in various convenient forms. Acceptable forms are:
  • days(Days) - integer days (ignores all time components)
  • ns(Nanoseconds) - integer nanoseconds
  • ms(Millis) - integer milliseconds
  • s(Seconds) - integer seconds