mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 08:08:02 +00:00
405 B
405 B
Create A Date With The Date Sigil
Elixir 1.3 introduced a new sigil for creating dates, ~D. It works in the
same way as Date's
new/3
function producing the Date struct with each of the date parts.
> ~D[2016-01-01]
~D[2016-01-01]
iex(7)> ~D[2016-01-01].year
2016
iex(8)> ~D[2016-01-01].month
1
iex(9)> ~D[2016-01-01].day
1