2 * Written by Richard W.M. Jones <rich@merjis.com>.
3 * Copyright (C) 2004 Merjis Ltd.
4 * $Id: cocanwiki_date.ml,v 1.2 2004/09/07 14:58:34 rich Exp $
12 let short_weekday = function
13 | 0 -> "Sun" | 1 -> "Mon" | 2 -> "Tue" | 3 -> "Wed"
14 | 4 -> "Thu" | 5 -> "Fri" | 6 -> "Sat" | 7 -> "Sun"
15 | _ -> invalid_arg "short_weekday"
17 let short_month = function
18 | 1 -> "Jan" | 2 -> "Feb" | 3 -> "Mar" | 4 -> "Apr"
19 | 5 -> "May" | 6 -> "Jun" | 7 -> "Jul" | 8 -> "Aug"
20 | 9 -> "Sep" | 10 -> "Oct" | 11 -> "Nov" | 12 -> "Dec"
21 | _ -> invalid_arg "short_month"
23 (* Generate a printable datestamp for pages. *)
24 let printable_date (date, _) =
25 sprintf "%d %s %04d" date.Dbi.day (short_month date.Dbi.month) date.Dbi.year
27 let printable_date_time (date, time) =
28 sprintf "%d %s %04d %02d:%02d" date.Dbi.day (short_month date.Dbi.month)
29 date.Dbi.year time.Dbi.hour time.Dbi.min