Ecto v2.2.12 Ecto.Date View Source
A deprecated Ecto type for dates.
This type is deprecated in favour of the :date
type.
Link to this section Summary
Functions
Casts the given value to date.
Same as cast/1
but raises Ecto.CastError
on invalid dates.
Compare two dates.
Converts an Ecto.Date
into a date triplet.
Returns an Ecto.Date
from an Erlang date tuple.
Converts a date triplet into an Ecto.Date
.
Returns an Erlang date tuple from an Ecto.Date
.
Converts Ecto.Date
to ISO8601 representation.
Converts Ecto.Date
to a readable string representation.
The Ecto primitive type.
Link to this section Functions
cast(d) View Source
Casts the given value to date.
It supports:
- a binary in the "YYYY-MM-DD" format
- a binary in the "YYYY-MM-DD HH:MM:SS" format
(may be separated by T and/or followed by "Z", as in
2014-04-17T14:00:00Z
) - a binary in the "YYYY-MM-DD HH:MM:SS.USEC" format
(may be separated by T and/or followed by "Z", as in
2014-04-17T14:00:00.030Z
) - a map with
"year"
,"month"
and"day"
keys with integer or binaries as values - a map with
:year
,:month
and:day
keys with integer or binaries as values - a tuple with
{year, month, day}
as integers or binaries - an
Ecto.Date
struct itself
cast!(value) View Source
Same as cast/1
but raises Ecto.CastError
on invalid dates.
compare(t1, t2) View Source
Compare two dates.
Receives two dates and compares the t1
against t2
and returns :lt
, :eq
or :gt
.
dump(arg1) View Source
Converts an Ecto.Date
into a date triplet.
from_erl(arg) View Source
Returns an Ecto.Date
from an Erlang date tuple.
load(arg1) View Source
Converts a date triplet into an Ecto.Date
.
to_erl(date) View Source
Returns an Erlang date tuple from an Ecto.Date
.
to_iso8601(date) View Source
Converts Ecto.Date
to ISO8601 representation.
to_string(date) View Source
Converts Ecto.Date
to a readable string representation.
type() View Source
The Ecto primitive type.
Returns an Ecto.Date
in UTC.