module Date: Libs.ExtNetdate.NetdateSupport for dates, including parsing and formating.type t = {
|
year : |
(* | the complete year | *) |
|
month : |
(* | a month, between 1 and 12 | *) |
|
day : |
(* | a day, between 1 and 31 | *) |
|
hour : |
(* | the number of hours since midnight, between 0 and 23 | *) |
|
minute : |
(* | the number of minutes since the beginning of the hour, between 0 and 59 | *) |
|
second : |
(* | the number of seconds since the begining of the minute, between 0 and 59 | *) |
|
zone : |
(* | the local zone offset, in minutes of advance wrt UTC. For instance, 60 = UTC+0100. | *) |
|
week_day : |
(* | the number of days since sunday, between 0 and 6
Note As a special exception, week_day may be -1, if the day of the week is unknown | *) |
val now : unit -> tnow () returns the current date, as expressed in the local zone.val localzone : intval create : ?zone:int -> float -> tval parse : string -> tval since_epoch : t -> floatval parse_epoch : string -> floatval format_to : 'a Extlib.InnerIO.output -> ?fmt:string -> t -> unit
The format string consists of zero or more conversion specifications
and ordinary characters. All ordinary characters are output directly
to the channel. A conversion specification consists of the '%'
character and one other character.
fmt : An optional format stating how the date/time should be
displayed. If unspecified, this will use the same format as
Date.mk_mail_date.
The conversion specifications are:
%A: full weekday name.%a: abbreviated weekday name.%B: full month name.%b: abbreviated month name.%C: (year / 100) as an integer; single digits are preceded by a zero.%c: equivalent to "%a %b %e %T %Y".%D: equivalent to "%m/%d/%y".%d: day of the month as an integer (01-31); single digits are
preceded by a zero.%e: day of the month as an integer (1-31).%H: hour (24-hour clock) as an integer (00-23).%h: the same as %b.%I: hour (12-hour clock) as an integer (01-12).%j: day of the year as an integer (001-366).%k: hour (24-hour clock) as an integer (0-23);
single digits are preceded by a blank.%l: hour (12-hour clock) as an integer (1-12);
single digits are preceded by a blank.%M: minute as an integer (00-59).%m: month as an integer (01-12).%n: a newline.%p: either "AM" or "PM" as appropriate.%P: either "am" or "pm" as appropriate.%R: equivalent to "%H:%M".%r: equivalent to "%I:%M:%S %p".%S: second as an integer (00-60).%T: equivalent to "%H:%M:%S".%t: a tab.%U: week number of the year (Sunday as the first day
of the week) as an integer (00-53).%u weekday (Monday as the first day of the week) as
an integer (1-7).%w: weekday (Sunday as the first day of the week) as
an integer (0-6).%X: representation of the time.%x: representation of the date.%Y: year with century as an integer.%y: year without century as an integer (00-99).%z: time zone offset from UTC; a leading plus sign
stands for east of UTC, a minus sign for west of UTC, hours and
minutes follow with two digits each and no delimiter between them
(common form for RFC 822 date headers).%%: a `%' character.val format : ?fmt:string -> t -> stringfmt : An optional format stating how the date/time should be
displayed. If unspecified, this will use the same format as
Date.mk_mail_date.val mk_mail_date : ?zone:int -> float -> string
Example: "Sun, 06 Nov 1994 08:49:37 -0500".
val mk_usenet_date : ?zone:int -> float -> string
Example: "Sunday, 06-Nov-94 08:49:37 -0500".
Note that this format has only two digits for the year.
val t_of_sexp : Sexplib.Sexp.t -> tval sexp_of_t : t -> Sexplib.Sexp.tval print : 'a Extlib.InnerIO.output -> t -> unit
The default format used is the same as Date.mk_mail_date