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}}
Source

Summary

from_date(date)

Converts a date to a datetime with the time set to 00:00:00

to_date(arg1)

Returns the date portion of a datetime

to_time(arg1)

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

Specs:

Returns the date portion of a datetime.

Examples

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

Specs:

Returns the time portion of a datetime.

Examples

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