Elixir converting datetime to string
To obtain a standard erlang
datetime value need to remove fourth value (microseconds) from the second tuple:
datetime = {{2017, 3, 21}, {0, 0, 0, 0}}
{{year, month, day}, {hours, minutes, seconds, _}} = datetime
datetime = {{year, month, day}, {hours, minutes, seconds}}
Poison.encode! Ecto.DateTime.from_erl(datetime)
#=> "\"2017-03-21T00:00:00\""