package http-date

  1. Overview
  2. Docs
HTTP Datetime encoder/decoder

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.2.tar.gz
md5=c05dd250cd2bcef94b9dedc0fda6202d
sha512=00cf1c4c6ca9dd95042707fb9b815bdd30532f3d0830a846bbbc46e6fc064a7565484241d8f8c2f517c9b1184492eeb2b8ff3efa6831cfe42e6c00fc69b3e162

doc/README.html

HTTP Date

HTTP timestamp decoders and encoders complaint to RFC 9110 (HTTP Semantics). It is designed to be used with HTTP Date header field.

The current supported formats for decoding/encoding are as follows:

  • IMF(Internet Message Format) date, eg Sun, 06 Nov 1994 08:49:37 GMT
  • RFC 850 date, eg Sunday, 06-Nov-94 08:49:37 GMT
  • asctime date, eg Sun Nov 6 08:49:37 1994

API usage:

  • Decoding and encoding IMF fixdate formatted timestamp values:
# let imf_fixdate = Http_date.decode "Sun, 06 Nov 1994 08:49:37 GMT";;
val imf_fixdate : Http_date.t = `IMF (`Sun, (1994, 11, 6), (8, 49, 37))

# Http_date.encode imf_fixdate;;
- : string = "Sun, 06 Nov 1994 08:49:37 GMT"

References:

Installation

opam install http-date

Using in Dune

Specify the dependency in dune executable or library stanza as follows:

  • executable
(executable
  (name hello)
  (libraries http-date))
  • library
 (library
   (name hello)
   (libraries http-date))