Current best way to store and use Dates

ecto
phoenix

#1

Hello, I am using Elixir 1.6.3, Phoenix 1.3.2, and phoenix_ecto 3.2.

I want to use dates like this: today = Date.utc_today.

How do set up the schema and migration for this? I know the date handling in Ecto etc has changed in the not-too-disatant past, but I haven’t kept up with new developments.


#2

Ecto deprecated it’s own DateTime modules and now uses regular Elixir DateTime.

Documentation can be found here: https://hexdocs.pm/ecto/Ecto.Schema.html#module-the-datetime-types and the changelog might also be useful: https://github.com/elixir-ecto/ecto/blob/master/CHANGELOG.md#backwards-incompatible-changes-1