package xapi-stdext-date

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Additional types and functions for dates

ISO 8601 Dates

type iso8601

An ISO-8601 date/time type.

val of_float : float -> iso8601

Convert calendar time x (as returned by e.g. Unix.time), to time in UTC.

val to_float : iso8601 -> float

Convert date/time to a float value: the number of seconds since 00:00:00 UTC, 1 Jan 1970. * Assumes the underlying iso8601 is in UTC

val to_string : iso8601 -> string

Convert date/time to an ISO 8601 formatted string.

val of_string : string -> iso8601

Convert ISO 8601 formatted string to a date/time value. * Does not accept a timezone annotated datetime - i.e. string must be UTC, and end with a Z

val assert_utc : iso8601 -> unit

Raises an Invalid_argument exception if the given date is not a UTC date. * A UTC date is an ISO 8601 strings that ends with the character 'Z'.

  • deprecated assertions performed inside constructors, so this fn does nothing
val never : iso8601

Representation of the concept "never" (actually 00:00:00 UTC, 1 Jan 1970).

val _localtime_string : Ptime.tz_offset_s option -> Ptime.t -> string

exposed for testing

val localtime : unit -> iso8601

RFC 822 Dates

type rfc822

An RFC 822 date/time type.

val rfc822_of_float : float -> rfc822

Convert calendar time x (as returned by e.g. Unix.time), to RFC 822.

val rfc822_to_string : rfc822 -> string

Convert RFC 822 date/time to a formatted string.

val eq : iso8601 -> iso8601 -> bool
OCaml

Innovation. Community. Security.