Prelude.Timeinclude module type of struct include Prelude_time endSee: Misha Wolf and Charles Wicksteed, Date and Time Formats, September 15, 1997
format date and time (pure-ocaml implementation of Posix strftime(3))
Bugs:
%U %V %W escapes are Not Yet Implemented and raise NYIparse doesn't attempt to parse a free-form date, but rather a date specified by a strftime format; it's to some extent the inverse of strftime.
(UNSUPPORTED (c)) is the type of exception raised by tm_of_string for an unsupported strtime escape character c.
type locale = {full_months : string list;abbr_months : string list;full_days : string list;abbr_days : string list;ampm : string list;}The type of locale-specific data for month names.
val locale : localelocale is the values for the en_US locale.
(parse format str) parses str according to strftime format format and returns values for each %-escape in format.
Example of parsing an American-style date format:
(Time.parse "%m/%e/%Y" "7/1/2003") = [|"7"; "1"; "2003"|](tm_of_string format str) parses str according to the strftime format, returning a Unix.tm.
The following strftime escapes are not supported: %j, %I, %l, %U, %V, %W, %Z, and %z.
Example:
(tm_of_string "%c" "Wed Aug 9 09:35:53 2023") = {Unix.tm_sec = 53; tm_min = 35; tm_hour = 9; tm_mday = 9; tm_mon = 7; tm_year = 123; tm_wday = 0; tm_yday = 0; tm_isdst = false}
(tm_of_string "%c" "Wed Aug 9 09:35:53 2023" |> strftime "%c") = "Sun Aug 9 09:35:53 2023"