如何使用 Ecto 获取明天的日期时间?

How to get tomorrows datetime with Ecto?

我可以像这样使用 Ecto 获取当前日期时间:

Ecto.DateTime.utc

但是我怎样才能得到明天的日期呢

Ecto.DateTime.utc + timedelta 1 day

?

这个问题的答案如何?

Ecto.DateTime.utc 
|> Ecto.DateTime.to_erl 
|> :calendar.datetime_to_gregorian_seconds 
|> Kernel.+(86400) 
|> :calendar.gregorian_seconds_to_datetime 
|> Ecto.DateTime.from_erl
Timex.shift(Timex.now, days: 1)

https://github.com/bitwalker/timex

iex(3)> t = DateTime.utc_now()
#DateTime<2018-07-17 08:22:11.472192Z>
iex(4)> n = %{t | day: t.day + 1}
#DateTime<2018-07-18 08:22:11.472192Z>
iex(5)> n
#DateTime<2018-07-18 08:22:11.472192Z>
iex(6)> m = %{t | day: t.day - 1}
#DateTime<2018-07-16 08:22:11.472192Z>
iex(7)> m
#DateTime<2018-07-16 08:22:11.472192Z>