package yocaml

  1. Overview
  2. Docs

Describes date (supposing naively that everything is in UTC).

Types

type t

Describes a complete date.

type month =
  1. | Jan
  2. | Feb
  3. | Mar
  4. | Apr
  5. | May
  6. | Jun
  7. | Jul
  8. | Aug
  9. | Sep
  10. | Oct
  11. | Nov
  12. | Dec

Months.

Aliases

Useful aliases for making the doc readable.

type year = int
type day = int
type hour = int
type min = int
type sec = int
type day_of_week =
  1. | Mon
  2. | Tue
  3. | Wed
  4. | Thu
  5. | Fri
  6. | Sat
  7. | Sun

Day of Week

API

val make : ?time:(hour * min * sec) -> year -> month -> day -> t Validate.t

Date.make ~time:(hour, min, sec) year month day tries to create a Date.t.

val from_string : string -> t Validate.t

Comparison and equality

val equal : t -> t -> bool
val compare : t -> t -> int

Pretty Printing

val pp : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val pp_rfc822 : ?default_time:(hour * min * sec) -> Stdlib.Format.formatter -> t -> unit

Retreive information

val to_pair : t -> (year * month * day) * (hour * min * sec) option
val month_to_int : month -> int

Starts at 1.

val month_to_string : month -> string

Date.month_to_string Dec is equal to "Dec".

val day_of_week : t -> day_of_week

A Fragile function which seems works at least for 1600 and to 3000 :)

val day_of_week_to_string : day_of_week -> string
OCaml

Innovation. Community. Security.