Up

module Day_of_week

: sig

For representing a day of the week.

#
type t =
# | Sun
# | Mon
# | Tue
# | Wed
# | Thu
# | Fri
# | Sat
include Comparable.S_binable with type t := t
include Hashable.S_binable with type t := t
include Stringable.S with type t := t

conversion between ints and weekdays uses the same mapping as Unix.tm_wday. 0 <-> Sun, ... 6 <-> Sat

#
val of_int : int -> t option

of_int i returns i'th weekday if i is in 0,1,...,6. Otherwise it returns None.

#
val of_int_exn : int -> t

of_int_exn i should have i in 0,1,...,6 and returns the i'th weekday.

#
val to_int : t -> int

to_int t returns an int in 0,1,...6.

#
val shift : t -> int -> t

shift t i goes forward (or backward) the specified number of weekdays

#
val num_days : from:t -> to_:t -> int

num_days ~from ~to_ gives the number of days that must elapse from a from to get to a to_, i.e. the smallest non-negative number i such that shift from i = to_.

#
val is_sun_or_sat : t -> bool

is_sun_or_sat returns true if t is Sunday or Saturday

#
val all : t list

Sun; Mon; Tue; Wed; Thu; Fri; Sat

#
val weekdays : t list

Mon; Tue; Wed; Thu; Fri

#
val weekends : t list

Sat; Sun

#
module Stable : sig
#
module V1 : sig
include sig
#
type __pa_nonrec_0 = t
#
type t = __pa_nonrec_0
end
with type __pa_nonrec_0 := t
#
val compare : t -> t -> int
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val bin_t : t Bin_prot.Type_class.t
#
val bin_read_t : t Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
#
val bin_reader_t : t Bin_prot.Type_class.reader
#
val bin_size_t : t Bin_prot.Size.sizer
#
val bin_write_t : t Bin_prot.Write.writer
#
val bin_writer_t : t Bin_prot.Type_class.writer
end
end
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val compare : t -> t -> int
#
val bin_t : t Bin_prot.Type_class.t
#
val bin_read_t : t Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
#
val bin_reader_t : t Bin_prot.Type_class.reader
#
val bin_size_t : t Bin_prot.Size.sizer
#
val bin_write_t : t Bin_prot.Write.writer
#
val bin_writer_t : t Bin_prot.Type_class.writer
end