Ecto v1.1.0 Ecto.Time
An Ecto type for time.
Summary
Functions
Casts the given value to time
Same as cast/1
but raises on invalid times
Compare two times
Converts an Ecto.Time
into a time tuple (in the form `{hour, min, sec,
usec}`)
Returns an Ecto.Time
from an Erlang time tuple
Returns an Erlang time tuple from an Ecto.Time
Converts Ecto.Time
to its ISO 8601 representation
Converts Ecto.Time
to a string representation
The Ecto primitive type
Returns an Ecto.Time
in UTC
Functions
Casts the given value to time.
It supports:
- a binary in the “HH:MM:DD” format
(may be followed by “Z”, as in
12:00:00Z
) - a binary in the “HH:MM:DD.USEC” format
(may be followed by “Z”, as in
12:00:00.005Z
) - a map with
"hour"
,"min"
keys with"sec"
and"usec"
as optional keys and values are integers or binaries - a map with
:hour
,:min
keys with:sec
and:usec
as optional keys and values are integers or binaries - a tuple with
{hour, min, sec}
as integers or binaries - a tuple with
{hour, min, sec, usec}
as integers or binaries - an
Ecto.Time
struct itself
Same as cast/1
but raises on invalid times.
Compare two times.
Receives two times and compares the t1
against t2
and returns :lt
, :eq
or :gt
.
Converts an Ecto.Time
into a time tuple (in the form `{hour, min, sec,
usec}`).
Returns an Ecto.Time
from an Erlang time tuple.
Returns an Ecto.Time
in local time.
WARNING: The local time is often not always increasing due
to DST changes, which can lead to bugs. Please prefer the
utc/1
function instead.
Returns an Erlang time tuple from an Ecto.Time
.
Converts Ecto.Time
to its ISO 8601 representation.
Converts Ecto.Time
to a string representation.
Returns an Ecto.Time
in UTC.
precision
can be :sec
or :usec.