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

from_date(date)

Specs

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}}
to_date(arg)

Returns the date portion of a datetime.

Examples

iex> {{2015, 2, 27}, {18, 30, 45}} |> to_date
{2015, 2, 27}
to_time(arg)

Returns the time portion of a datetime.

Examples

iex> {{2015, 2, 27}, {18, 30, 45}} |> to_time
{18, 30, 45}