Library
Module
Module type
Parameter
Class
Class type
HTTP timestamp decoders and encoders complaint to RFC 9110 (HTTP Semantics).
The current supported formats for decoding/encoding are as follows:
"Sun, 06 Nov 1994 08:49:37 GMT"
"Sunday, 06-Nov-94 08:49:37 GMT"
Obsolete"Sun Nov 6 08:49:37 1994"
ObsoleteHTTP timestamps are always in GMT/UTC
References
decode s
is ptime
if s
contains a valid textual representation of formats defined in encoding
.
century
An integer value representing century component of a year. This is used to decode the correct year component of ptime
, if s
contains RFC 850 encoded date value, e.g. year 96
is decoded as 1996
if century = 19
. If century
is not given, then the decoded year component is used as is, i.e. 96
.
decoding string in IMF fix date format:
Http_date.decode "Sun, 06 Nov 1994 08:49:37 GMT"
val encode : ?encoding:encoding -> Ptime.t -> string
encode ?encoding ptime
encodes ptime
into a given encoding
textual representation. The default value of encoding
is IMF
.
val pp : ?encoding:encoding -> Stdlib.Format.formatter -> Ptime.t -> unit
pp ?encoding fmt ptime
is like encode ?encoding ptime
except it prints out to fmt
instead of a string.