Module Printer


module Printer: sig .. end
Pretty printing.

In the following, an "event" is either a date or a time or a calendar.

This module implements three printers: one for each kind of events. The three printers have the same signature: they mainly implement a fprint : string -> formatter -> t -> unit function and a from_fstring : string -> string -> t function. The first one prints an event according to a format string (see below for a description of such a format). The second one converts a string to an event according to a format string.

A format string follows the unix date utility (with few modifications). It is a string which contains two types of objects: plain characters and conversion specifications. Those specifications are introduced by a % character and their meanings are:

By default, date pads numeric fields with zeroes. Two special modifiers between `%' and a numeric directive are recognized: For example:
Since 1.05


Internationalization

You can manage the string representations of days and months. By default, the English names are used but you can change their by setting the references day_name and month_name.

For example, day_name := function Date.Mon -> "lundi" | Date.Tue -> "mardi" | Date.Wed -> "mercredi" | Date.Thu -> "jeudi" | Date.Fri -> "vendredi" | Date.Sat -> "samedi" | Date.Sun -> "dimanche" sets the names of the days to the French names.

val day_name : (Date.day -> string) Pervasives.ref
String representation of a day.
val name_of_day : Date.day -> string
name_of_day d is equivalent to !day_name d. Used by the specification %A.
val short_name_of_day : Date.day -> string
short_name_of_day d returns the 3 first characters of name_of_day d. Used by the specification %a.
val month_name : (Date.month -> string) Pervasives.ref
String representation of a month.
val name_of_month : Date.month -> string
name_of_month m is equivalent to !day_month m. Used by the specification %B.
val short_name_of_month : Date.month -> string
short_name_of_month d returns the 3 first characters of name_of_month d. Used by the specification %b.

Printers


module type S = sig .. end
module DatePrinter: S  with type t = Date.t
Date printer.
module TimePrinter: S  with type t = Time.t
Time printer.
module CalendarPrinter: S  with type t = Calendar.t
Calendar printer.