Library
Module
Module type
Parameter
Class
Class type
date
, time
and datetime
parse a string
and return the corresponding timestamp (as float
).
Times are always converted to UTC representation.
For each of these functions, a _lex
suffixed function read from a Lexing.lexbuf
instead of a string
.
datetime
functions also take an optional boolean reqtime
indicating if parsing must fail if a date is given and not a complete datetime. (Default is true).
Functions with _tz
in their name return a float * float option
representing timestamp * offset option (timezone)
. timestamp
will be the UTC time, and offset option
is just an information about the original timezone.
NB: fractionnal part of timestamps will be lost when printing with current implementation.
pp_format fmt format x tz
x
is the timestamp, and tz
the time zone offset.
The format
string is a character string which contains two types of objects: plain characters, which are simply copied to fmt
, and conversion specifications, each of which causes conversion and printing of (a part of) x
or tz
.
If you do not want to use a timezone, set it to 0.
Conversion specifications have the form %X
, where X can be:
Y
: YearM
: MonthD
: Dayh
: Hoursm
: Minutess
: SecondsZ
: Hours of tz
offset (with its sign)z
: Minutes of tz
offset (without sign)%
: The '%' character"%Y-%M-%DT%h:%m:%s%Z:%z" format.
"%Y%M%DT%h%m%s%Z%z" format.