Date.Period
A period is the number of days between two dates.
type +'a p constraint 'a = [< field ]
val make : int -> int -> int -> t
make year month day
makes a period of the specified length.
val lmake : ?year:int -> ?month:int -> ?day:int -> unit -> t
Labelled version of make
. The default value of each argument is 0
.
val year : int -> [> `Year ] period
year n
makes a period of n
years.
val month : int -> [> `Year | `Month ] period
month n
makes a period of n
months.
val week : int -> [> `Week | `Day ] period
week n
makes a period of n
weeks.
val day : int -> [> `Week | `Day ] period
day n
makes a period of n
days.
val nb_days : 'a period -> int
Number of days in a period.
val safe_nb_days : [< `Week | `Day ] period -> int
Equivalent to nb_days
but never raises any exception.
val ymd : 'a period -> int * int * int
Number of years, months and days in a period. @example ymd (make 1 2 3)
returns 1, 2, 3
.