package xapi-stdext-date

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

Module Xapi_stdext_date.DateSource

Additional types and functions for dates

ISO 8601 Dates

Sourcetype iso8601

An ISO-8601 date/time type.

Sourceval of_float : float -> iso8601

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

Sourceval 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

Sourceval to_string : iso8601 -> string

Convert date/time to an ISO 8601 formatted string.

Sourceval 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

Sourceval 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
Sourceval never : iso8601

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

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

exposed for testing

Sourceval localtime : unit -> iso8601

RFC 822 Dates

Sourcetype rfc822

An RFC 822 date/time type.

Sourceval rfc822_of_float : float -> rfc822

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

Sourceval rfc822_to_string : rfc822 -> string

Convert RFC 822 date/time to a formatted string.

Sourceval eq : iso8601 -> iso8601 -> bool