Ecto v2.2.12 Ecto.Time View Source
A deprecated Ecto type for time.
This type is deprecated in favour of the :time
type.
Link to this section Summary
Functions
Casts the given value to time.
Same as cast/1
but raises Ecto.CastError
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.
Link to this section Functions
cast(t) View Source
Casts the given value to time.
It supports:
- a binary in the "HH:MM:SS" format
(may be followed by "Z", as in
12:00:00Z
) - a binary in the "HH:MM:SS.USEC" format
(may be followed by "Z", as in
12:00:00.005Z
) - a map with
"hour"
,"minute"
keys with"second"
and"microsecond"
as optional keys and values are integers or binaries - a map with
:hour
,:minute
keys with:second
and:microsecond
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
cast!(value) View Source
Same as cast/1
but raises Ecto.CastError
on invalid times.
compare(t1, t2) View Source
Compare two times.
Receives two times and compares the t1
against t2
and returns :lt
, :eq
or :gt
.
dump(arg1) View Source
Converts an Ecto.Time
into a time tuple (in the form {hour, min, sec, usec}
).
from_erl(arg) View Source
Returns an Ecto.Time
from an Erlang time tuple.
load(time) View Source
Converts a time tuple like the one returned by dump/1
into an Ecto.Time
.
to_erl(time) View Source
Returns an Erlang time tuple from an Ecto.Time
.
to_iso8601(time) View Source
Converts Ecto.Time
to its ISO 8601 representation.
to_string(time) View Source
Converts Ecto.Time
to a string representation.
type() View Source
The Ecto primitive type.
utc(precision \\ :sec) View Source
Returns an Ecto.Time
in UTC.
precision
can be :sec
or :usec.