Module Date.Period


module Period: sig .. end


A period is the number of days between two date.

Arithmetic operations


include Period.S

Constructors


val make : int -> int -> int -> Date.t
make year month day makes a period of the specified length.
val lmake : ?year:int -> ?month:int -> ?day:int -> unit -> Date.t
Labelled version of make. The default value of each argument is 0.
val year : int -> Date.t
year n makes a period of n years.
val month : int -> Date.t
month n makes a period of n months.
val week : int -> Date.t
week n makes a period of n weeks.
val day : int -> Date.t
day n makes a period of n days.

Getters


exception Not_computable
Since 1.04
val nb_days : Date.t -> int
Number of days in a period. Throw Not_computable if the number of days is not computable. E.g. nb_days (day 6) returns 6 but nb_days (year 1) throws Not_computable because a year is not a constant number of days.
Since 1.04
val ymd : Date.t -> int * int * int
Number of years, months and days in a period. E.g. ymd (make 1 2 3) returns 1, 2, 3.
Since 1.09.0