Library
Module
Module type
Parameter
Class
Class type
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
val of_unix_time : float -> t
Convert calendar time x
(as returned by e.g. Unix.time), to time in UTC
val 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
val to_rfc822 : t -> string
Convert date/time to email-formatted (RFC 822) string.
val to_rfc3339 : t -> string
Convert date/time to an RFC-3339-formatted string. It also complies with the ISO 8601 format
val 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
val epoch : t
00:00:00 UTC, 1 Jan 1970, in UTC
val now : unit -> t
Count the number of seconds passed since 00:00:00 UTC, 1 Jan 1970, in UTC
val _localtime_string : Ptime.tz_offset_s option -> Ptime.t -> string
exposed for testing
val localtime : unit -> t
Count the number of seconds passed since 00:00:00 UTC, 1 Jan 1970, in local time
Deprecated bindings, these will be removed in a future release:
val rfc822_of_float : float -> t
Same as of_unix_time
val of_float : float -> t
Same as of_unix_time
val to_float : t -> float
Same as to_unix_time
val to_string : t -> string
Same as to_rfc3339
val of_string : string -> t
Same as of_iso8601
val assert_utc : t -> 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'