package xapi-stdext-date

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

Module Xapi_stdext_date.DateSource

Sourcetype t

date-time with support for keeping timezone for ISO 8601 conversion

Conversions

Sourceval of_ptime : Ptime.t -> t

Convert ptime to time in UTC

Sourceval to_ptime : t -> Ptime.t

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

Sourceval of_unix_time : float -> t

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

Sourceval to_unix_time : t -> float

Convert date/time to a unix timestamp: the number of seconds since 00:00:00 UTC, 1 Jan 1970. Assumes the underlying t is in UTC

Sourceval to_rfc822 : t -> string

Convert date/time to email-formatted (RFC 822) string.

Sourceval to_rfc3339 : t -> string

Convert date/time to an RFC-3339-formatted string. It also complies with the ISO 8601 format

Sourceval of_iso8601 : string -> t

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 epoch : t

00:00:00 UTC, 1 Jan 1970, in UTC

Sourceval now : unit -> t

Count the number of seconds passed since 00:00:00 UTC, 1 Jan 1970, in UTC

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

exposed for testing

Sourceval localtime : unit -> t

Count the number of seconds passed since 00:00:00 UTC, 1 Jan 1970, in local time

Comparisons

Sourceval eq : t -> t -> bool

eq a b returns whether a and b are equal

Sourceval compare : t -> t -> int

compare a b returns -1 if a is earlier than b, 1 if a is later than b or the ordering of the timezone printer

Sourceval is_earlier : than:t -> t -> bool

is_earlier ~than a returns whether the timestamp a happens before than

Sourceval is_later : than:t -> t -> bool

is_later ~than a returns whether the timestamp a happens after than

Sourceval diff : t -> t -> Ptime.Span.t

diff a b returns the span of time corresponding to a - b

Deprecated bindings, these will be removed in a future release:

Sourceval rfc822_to_string : t -> string

Same as to_rfc822

Sourceval rfc822_of_float : float -> t

Same as of_unix_time

Sourceval of_float : float -> t

Same as of_unix_time

Sourceval to_float : t -> float

Same as to_unix_time

Sourceval to_string : t -> string

Same as to_rfc3339

Sourceval of_string : string -> t

Same as of_iso8601

Sourceval never : t

Same as epoch

Sourcetype iso8601 = t

Deprecated alias for t

Sourcetype rfc822 = t

Deprecated alias for t

OCaml

Innovation. Community. Security.