Module Date


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


type t = private {
   y : int;
   m : Month.t;
   d : int;
}
include Sexpable
include Binable
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
val create : y:int -> m:Month.t -> d:int -> t
val of_tm : Core_unix.tm -> t
val of_time : Time_internal.T.t -> t
val to_string_iso8601_extended : t -> string
val of_string_iso8601_extended : string -> pos:int -> t
val of_string_iso8601_basic : string -> pos:int -> t
val to_string_iso8601_basic : t -> string
val to_string_old : t -> string
val pp : Format.formatter -> t -> unit
val day : t -> int
val month : t -> Month.t
val year : t -> int
val today : unit -> t
val day_of_week : t -> Weekday.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
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
module Export: sig .. end