type t = private {
y : int;
m : Core_kernel.Std.Month.t;
d : int;
}
include Core_kernel.Std.Hashable_binable with type t := t
converts a string to a date, in formats: m/d/y y-m-d (* valid iso8601_extended *) DD MMM YYYY DDMMMYYYY YYYYMMDD
include Core_kernel.Std.Stringable with type t := t
include Core_kernel.Std.Comparable_binable with type t := t
include Core_kernel.Std.Pretty_printer.S with type t := t
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 is_weekend : t -> bool
val is_weekday : t -> bool
val is_business_day : t -> is_holiday:(t -> bool) -> bool
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.Calendar_events.is_holiday as a conveninent 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 Export : sig .. end
type _date = private t = private {
y : int;
m : Core_kernel.Std.Month.t;
d : int;
}
module Stable : sig .. end
module V1 : sig .. end
include sig .. end with type __pa_nonrec_0 := t
type __pa_nonrec_0 = private t = private {
y : int;
m : Core_kernel.Std.Month.t;
d : int;
}
type t = private __pa_nonrec_0 = private {
y : int;
m : Core_kernel.Std.Month.t;
d : int;
}
val compare : t -> t -> int
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
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
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