GoodTimes v1.1.1 GoodTimes.Convert
Convert to and from dates, datetimes, and times.
Examples
iex> {{2015, 2, 27}, {18, 30, 45}} |> to_date
{2015, 2, 27}
iex> {2015, 2, 27} |> from_date
{{2015, 2, 27}, {0, 0, 0}}
Summary
Functions
Converts a date to a datetime with the time set to 00:00:00
Returns the date portion of a datetime
Returns the time portion of a datetime
Functions
Specs
from_date(GoodTimes.date) :: GoodTimes.datetime
Converts a date to a datetime with the time set to 00:00:00.
Examples
iex> {2015, 2, 27} |> from_date
{{2015, 2, 27}, {0, 0, 0}}
Specs
to_date(GoodTimes.datetime) :: GoodTimes.date
Returns the date portion of a datetime.
Examples
iex> {{2015, 2, 27}, {18, 30, 45}} |> to_date
{2015, 2, 27}
Specs
to_time(GoodTimes.datetime) :: GoodTimes.time
Returns the time portion of a datetime.
Examples
iex> {{2015, 2, 27}, {18, 30, 45}} |> to_time
{18, 30, 45}