Ecto v1.1.0 Ecto.Date
An Ecto type for dates.
Summary
Functions
Casts the given value to date
Same as cast/1
but raises 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
Functions
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:DD” 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:DD.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
Same as cast/1
but raises on invalid dates.
Compare two dates.
Receives two dates and compares the t1
against t2
and returns :lt
, :eq
or :gt
.
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 Ecto.Date
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/0
function instead.
Returns an Erlang date tuple from an Ecto.Date
.
Converts Ecto.Date
to ISO8601 representation.
Converts Ecto.Date
to a readable string representation.
Returns an Ecto.Date
in UTC.