Module Timedesc.Utils

val ptime_span_of_span : Span.t -> Ptime.span option
val ptime_of_timestamp : timestamp -> Ptime.t option
val span_of_ptime_span : Ptime.span -> Span.t

Warning: Subnanosecond information is lost in this conversion

val timestamp_of_ptime : Ptime.t -> timestamp

Warning: Subnanosecond information is lost in this conversion

val day_count_of_year : year:int -> int
val day_count_of_month : year:int -> month:int -> int
val week_count_of_iso_year : year:int -> int

Month utils

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
]
val human_int_of_month : month -> int

This yields the usual human readable numbering of 1 to 12 inclusive

val index_of_month : month -> int

This yields the index based numbering of 0 to 11 inclusive

val month_of_human_int : int -> month option
val month_of_index : int -> month option
val weekday_of_tm_int : int -> weekday option
val tm_int_of_weekday : weekday -> int
val weekday_of_iso_int : int -> weekday option
val iso_int_of_weekday : weekday -> int
val get_local_tz_for_arg : unit -> Time_zone.t
val abbr_string_of_weekday : weekday -> string

Warning: Following functions are direct applications of the relevant formulas with little to no error checking.

You are advised to read the source code of the following functions in date_time_utils.ml if you intend to use them to ensure they behave as you expect.

val is_leap_year : year:int -> bool
val jd_of_ymd : year:int -> month:int -> day:int -> int
val jd_of_ydoy : year:int -> day_of_year:int -> int
val jd_of_date : Date.t -> int
val jd_of_unix_epoch : int
val jd_span_of_unix_epoch : Span.t
val jd_of_iso_week_date : year:int -> week:int -> weekday:weekday -> int
val ymd_of_jd : int -> int * int * int
val weekday_of_jd : int -> weekday
val iso_week_date_of_jd : int -> int * int * weekday
val doy_of_ymd : year:int -> month:int -> day:int -> int