Module Netdate


module Netdate: sig .. end
Support for common date/time parsing and formatting. Many routines refer to the epoch, which for Unix is 00:00:00 UTC, January 1, 1970.


type t = {
   year : int; (*complete year*)
   month : int; (*1..12*)
   day : int; (*1..31*)
   hour : int;
   minute : int;
   second : int;
   zone : int; (*in minutes; 60 = UTC+0100*)
   week_day : int; (*0 = sunday; -1 if not given*)
}
val localzone : int
The offset in minutes for the local time zone from the UTC
val create : ?zone:int -> float -> t
Convert the time (seconds since the epoch) to a date/time record
val parse : string -> t
Parse a string and return a date/time record
val since_epoch : t -> float
Convert a date/time record into the time (seconds since the epoch)
val parse_epoch : string -> float
Parse a string and return the time (seconds since the epoch
val format_to : Netchannels.out_obj_channel -> fmt:string -> t -> unit
Format a date/time record according to the format string and outputs the resulting string to the channel.

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.

The conversion specifications are:


val format : fmt:string -> t -> string
Format a date/time record as a string
val mk_mail_date : ?zone:int -> float -> string
Convert the time (seconds since the epoch) to a date string that conforms to RFC 1123 (which updates RFC 822).

Example: "Sun, 06 Nov 1994 08:49:37 -0500".

val mk_usenet_date : ?zone:int -> float -> string
Convert the time (seconds since the epoch) to a date string that conforms to RFC 1036 (which obsoletes RFC 850).

Example: "Sunday, 06-Nov-94 08:49:37 -0500".

Note that this format has only two digits for the year.