package granary

  1. Overview
  2. Docs
Pure-OCaml SQL engine

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.0.3.tar.gz
sha256=8b18780ea373be48301d9f333925860a2f9110fc0ac28684295118d72b65a67e
sha512=25ca3c9c5e2b528704a542502e0f37dc33ba003f65622d969b8c2b800778585f8ef0cf89b36e6679832e3993e8303aecddfc662742baf7044d6afe4a796b8f11

doc/granary.sql/Granary_sql/Datetime/index.html

Module Granary_sql.DatetimeSource

Pure-OCaml date/time module for SQL date/time functions.

Sourcetype dt = {
  1. year : int;
  2. month : int;
  3. day : int;
  4. hour : int;
  5. min : int;
  6. sec : float;
}
Sourceval parse : ?now:(unit -> float) -> string -> (dt, string) result

Parse a time string. Accepted formats:

  • 'YYYY-MM-DD' — date only, time = 00:00:00
  • 'YYYY-MM-DD HH:MM:SS' — date and time (space or T separator)
  • 'HH:MM[:SS]' — time only, date = 2000-01-01
  • 'now' — requires ~now clock; returns current UTC time
  • integer/float — unix epoch or Julian day number
Sourceval to_date : dt -> string

"YYYY-MM-DD"

Sourceval to_time : dt -> string

"HH:MM:SS"

Sourceval to_datetime : dt -> string

"YYYY-MM-DD HH:MM:SS"

Sourceval to_julianday : dt -> float

Julian day number.

Sourceval to_unixepoch : dt -> int64

Seconds since the Unix epoch.

Sourceval strftime : string -> dt -> string

strftime fmt dt formats dt using fmt. Supported: %Y %m %d %H %M %S %f %j %s %%