# Module Time0.Date

    module Date: Date0

    type t

    include Hashable_binable

    include Stringable

converts a string to a date, in formats: m/d/y y-m-d (* valid iso8601_extended *) DD MMM YYYY DDMMMYYYY YYYYMMDD

    include Comparable_binable

    include Pretty_printer.S

    val create_exn : y:int -> m:Core_kernel.Std.Month.t -> d:int -> t

`create_exn ~y ~m ~d` creates the date specified in the arguments. Arguments are validated, and are not normalized in any way. So, days must be within the limits for the month in question, numbers cannot be negative, years must be fully specified, etc.

    val of_tm : Core_unix.tm -> t

    val of_string_iso8601_basic : string -> pos:int -> t

    val to_string_iso8601_basic : t -> string

    val to_string_american : t -> string

    val day : t -> int

    val month : t -> Core_kernel.Std.Month.t

    val year : t -> int

    val day_of_week : t -> Core_kernel.Std.Day_of_week.t

    val week_number : t -> int

Week of the year, from 1 to 53. According to ISO 8601, weeks start on Monday, and the first week of a year is the week that contains the first Thursday of the year. Notice that this means that dates near the end of the year can have week number 1, and dates near the beginning of the year can have week number 52 or 53.

Warning: the triple (year, week number, week day) does not identify a date -- e.g. 2012-01-02 and 2012-12-31 are both Mondays of week 1. (However, if instead of the year, you use the year of the nearest Thursday, then it does work.)

    val is_weekend : t -> bool

    val is_weekday : t -> bool

    val is_business_day : t -> is_holiday:(t -> bool) -> bool

Monday through Friday are business days, unless they're a holiday. Use `Pnl_db.Holidays.is_holiday` as a convenient holiday function.

    val add_days : t -> int -> t

    val add_months : t -> int -> t

`add_months t n` returns date with max days for the month if the date would be invalid. e.g. adding 1 month to Jan 30 results in Feb 28 due to Feb 30 being an invalid date, Feb 29 is returned in cases of leap year. *

    val diff : t -> t -> int

`diff t1 t2` returns date `t1` minus date `t2` in days.

    val add_weekdays : t -> int -> t

`add_weekdays t 0` returns the next weekday if `t` is a weekend and `t` otherwise. Unlike add_days this is done by looping over the count of days to be added (forward or backwards based on the sign), and is O(n) in the number of days to add. Beware, `add_weekdays sat 1` or `add_weekdays sun 1` both return the next `tue`, not the next `mon`. You may want to use `following_weekday` if you want the next following weekday, `following_weekday (fri|sat|sun)` would all return the next `mon`.

    val add_business_days : t -> is_holiday:(t -> bool) -> int -> t

`add_business_days t ~is_holiday n` returns a business day even when `n=0`. `add_business_days ~is_holiday:(fun _ -> false) ...` is the same as `add_weekdays`. Use `Pnl_db.Holidays.is_holiday` as a convenient holiday function.

    val dates_between : min:t -> max:t -> t list

    val business_dates_between : min:t -> max:t -> is_holiday:(t -> bool) -> t list

    val weekdays_between : min:t -> max:t -> t list

    val previous_weekday : t -> t

    val following_weekday : t -> t

    val first_strictly_after : t -> on:Core_kernel.Std.Day_of_week.t -> t

`first_strictly_after t ~on:day_of_week` returns the first occurrence of `day_of_week` strictly after `t`.

    module Stable: sig .. end

    module O: sig .. end

    val t_of_sexp : Sexplib.Sexp.t -> t

    val sexp_of_t : t -> Sexplib.Sexp.t

    val bin_t : t Core_kernel.Std.Bin_prot.Type_class.t

    val bin_read_t : t Core_kernel.Std.Bin_prot.Read.reader

    val __bin_read_t__ : (int -> t) Core_kernel.Std.Bin_prot.Read.reader

    val bin_reader_t : t Core_kernel.Std.Bin_prot.Type_class.reader

    val bin_size_t : t Core_kernel.Std.Bin_prot.Size.sizer

    val bin_write_t : t Core_kernel.Std.Bin_prot.Write.writer

    val bin_writer_t : t Core_kernel.Std.Bin_prot.Type_class.writer

converts a string to a date, in formats: m/d/y y-m-d (* valid iso8601_extended *) DD MMM YYYY DDMMMYYYY YYYYMMDD
`create_exn ~y ~m ~d` creates the date specified in the arguments. Arguments are validated, and are not normalized in any way. So, days must be within the limits for the month in question, numbers cannot be negative, years must be fully specified, etc.
Week of the year, from 1 to 53. According to ISO 8601, weeks start on Monday, and the first week of a year is the week that contains the first Thursday of the year. Notice that this means that dates near the end of the year can have week number 1, and dates near the beginning of the year can have week number 52 or 53.

Warning: the triple (year, week number, week day) does not identify a date -- e.g. 2012-01-02 and 2012-12-31 are both Mondays of week 1. (However, if instead of the year, you use the year of the nearest Thursday, then it does work.)
Monday through Friday are business days, unless they're a holiday. Use `Pnl_db.Holidays.is_holiday` as a convenient holiday function.
`add_months t n` returns date with max days for the month if the date would be invalid. e.g. adding 1 month to Jan 30 results in Feb 28 due to Feb 30 being an invalid date, Feb 29 is returned in cases of leap year. *
`diff t1 t2` returns date `t1` minus date `t2` in days.
`add_weekdays t 0` returns the next weekday if `t` is a weekend and `t` otherwise. Unlike add_days this is done by looping over the count of days to be added (forward or backwards based on the sign), and is O(n) in the number of days to add. Beware, `add_weekdays sat 1` or `add_weekdays sun 1` both return the next `tue`, not the next `mon`. You may want to use `following_weekday` if you want the next following weekday, `following_weekday (fri|sat|sun)` would all return the next `mon`.
`add_business_days t ~is_holiday n` returns a business day even when `n=0`. `add_business_days ~is_holiday:(fun _ -> false) ...` is the same as `add_weekdays`. Use `Pnl_db.Holidays.is_holiday` as a convenient holiday function.
`first_strictly_after t ~on:day_of_week` returns the first occurrence of `day_of_week` strictly after `t`.