Mandrake v0.0.1 Mandrake.DateTime

Mandrake functions for date and time.

Summary

Functions

Add date to time

Add time to date

Format date to dd mm yyyy with the given divider

Extract date to date_time

Extract time to date_time

Format date, time or date_time with the given divider

Format date/time with the given pattern and list using :io_lib.format

Returns a function for date or time formatting

Get current date and time

Get current date

Get current local date and time

Get current local date

Get current local time

Get current time

Returns true if first date_time is < than second

Returns true if first date_time is > than second

Returns the difference in seconds beetween two date_time elements (date_2 - date_1)

Returns days and time correspondig given seconds

Functions

add_date(time)

Add date to time.

Examples

iex>  Mandrake.DateTime.add_date({15, 34, 18})
{{2015, 11, 29}, {15, 34, 18}}
add_time(date)

Add time to date.

Examples

iex>  Mandrake.DateTime.add_time({2015, 11, 29})
{{2015, 11, 29}, {0, 0, 0}}
dd_mm_yyyy(arg, divider)

Format date to dd mm yyyy with the given divider.

Examples

iex>  Mandrake.DateTime.dd_mm_yyyy({2015,12,31}, "/")
"31/12/2015"
extract_date(arg)

Extract date to date_time.

Examples

iex>  Mandrake.DateTime.extract_date({{2015, 11, 29}, {15, 34, 18}})
{2015, 11, 29}
extract_time(arg)

Extract time to date_time.

Examples

iex>  Mandrake.DateTime.extract_time({{2015, 11, 29}, {15, 34, 18}})
{15, 34, 18}
format(arg)
format(arg, divider)

Format date, time or date_time with the given divider.

Examples

iex>  Mandrake.DateTime.format({{2015,12,31}, {10,30,15}}, "/")
"2015/12/31 10:30:15"
iex>  Mandrake.DateTime.format({2015,12,31}, "/")
"2015/12/31"
iex>  Mandrake.DateTime.format({10,30,15})
"10:30:15"
format_date_time(pattern, list)

Format date/time with the given pattern and list using :io_lib.format.

Examples

iex>  Mandrake.DateTime.format_date_time("~2..0B:~2..0B:~2..0B", [10 ,30 ,15 ])
"10:30:15"
format_with_divider(divider)

Returns a function for date or time formatting.

Examples

iex>  formatWithSlash = Mandrake.DateTime.format_with_divider("/")
...>  formatWithSlash.({{2015,12,31}, {10,30,15}})
"2015/12/31 10:30:15"
get()

Get current date and time.

Examples

iex>  Mandrake.DateTime.get()
{{2015, 11, 29}, {15, 34, 18}}
get_date()

Get current date.

Examples

iex>  Mandrake.DateTime.get_date()
{2015, 11, 29}
get_local()

Get current local date and time.

Examples

iex>  Mandrake.DateTime.get_local()
{{2015, 11, 29}, {15, 34, 18}}
get_local_date()

Get current local date.

Examples

iex>  Mandrake.DateTime.get_local_date()
{2015, 11, 29}
get_local_time()

Get current local time.

Examples

iex>  Mandrake.DateTime.get_local_time()
{15, 34, 18}
get_time()

Get current time.

Examples

iex>  Mandrake.DateTime.get_time()
{15, 34, 18}
is_future(date_1, date_2)

Returns true if first date_time is < than second.

Examples

iex>  Mandrake.DateTime.is_future({{2015, 11, 29}, {15, 34, 18}}, {{2015, 11, 28}, {15, 34, 18}})
false
is_past(date_1, date_2)

Returns true if first date_time is > than second.

Examples

iex>  Mandrake.DateTime.is_past({{2015, 11, 29}, {15, 34, 18}}, {{2015, 11, 28}, {15, 34, 18}})
true
offset(date_1, date_2)

Returns the difference in seconds beetween two date_time elements (date_2 - date_1).

Examples

iex>  Mandrake.DateTime.offset({{2015, 11, 29}, {15, 34, 18}}, {{2015, 11, 30}, {15, 34, 18}})
86400
seconds_to_date_time(seconds)

Returns days and time correspondig given seconds.

Examples

iex>  Mandrake.DateTime.seconds_to_date_time(86400)
{1, {0, 0, 0}}