Module uef_time

Data Types

date()

date() = calendar:date()

{Year, Month, Day}

datetime()

datetime() = calendar:datetime()

{{Year, Month, Day}, {Hour, Min, Sec}}

pday()

pday() = day | days

period()

period() = {integer(), ptype()} | {ptype(), integer()}

periods()

periods() = [period()]

phour()

phour() = hrs | hour | hours

pminute()

pminute() = min | minute | minutes

pmonth()

pmonth() = month | months

psecond()

psecond() = sec | second | seconds

ptype()

ptype() = psecond() | pminute() | phour() | pday() | pmonth() | pyear()

pyear()

pyear() = year | years

Function Index

add_days/1 Same as uef_time:add_seconds(Days * 86400).
add_days/2 Adds the number of days Days to DateOrDatetime and returns a new date or datetime value.
add_hours/1 Same as uef_time:add_seconds(Hours * 3600).
add_hours/2 Adds the number of hours Hours to DateOrDatetime and returns a new datetime value.
add_minutes/1 Same as uef_time:add_seconds(Minutes * 60).
add_minutes/2 Adds the number of minutes Minutes to DateOrDatetime and returns a new datetime value.
add_months/1 Same as uef_time:add_months(erlang:localtime(), Months).
add_months/2 Adds the number of months Months to DateOrDatetime and returns a new date or datetime value.
add_seconds/1 Same as uef_time:add_seconds(erlang:localtime(), Seconds).
add_seconds/2 Adds the number of seconds Seconds to DateOrDatetime and returns a new datetime value.
add_time/1 Same as uef_time:add_time(erlang:localtime(), Periods).
add_time/2 Adds one or more periods of time to DateOrDatetime and returns a new date or datetime value.
add_weeks/1 Same as uef_time:add_seconds(Weeks * 604800).
add_weeks/2 Adds the number of weeks Weeks to DateOrDatetime and returns a new date or datetime value.
add_years/1 Same as uef_time:add_years(erlang:localtime(), Years).
add_years/2 Adds the number of years Years to DateOrDatetime and returns a new date or datetime value.
days_diff/1 Returns the difference in days between Date and the current local date provided by function erlang:date().
days_diff/2 Returns the difference in days between Date2 and Date1.
seconds_diff/1 Returns the difference in seconds between Date and the current local time provided by function erlang:localtime().
seconds_diff/2 Returns the difference in seconds between DateTime2 and DateTime1.
today/0 Returns the current date as {Year, Month, Day}.
tomorrow/0 Returns tomorrow's date as {Year, Month, Day}.
unix_time/0 Returns the current number of seconds since 00:00:00 (UTC), 1 January 1970.
unix_time/1 Returns the number of seconds elapsed between 00:00:00 (UTC), 1 January 1970 and Datetime.
yesterday/0 Returns yesterday's date as {Year, Month, Day}.

Function Details

add_days/1

add_days(Days::integer()) -> datetime()

Same as uef_time:add_seconds(Days * 86400). See docs of uef_time:add_seconds/1.

add_days/2

add_days(DateOrDatetime::date() | datetime(), Days::integer()) -> NewDateOrDateTime::date() | datetime()

Adds the number of days Days to DateOrDatetime and returns a new date or datetime value. The type of NewDateOrDateTime is the same as the type of DateOrDatetime.

add_hours/1

add_hours(Hours::integer()) -> datetime()

Same as uef_time:add_seconds(Hours * 3600). See docs of uef_time:add_seconds/1.

add_hours/2

add_hours(DateOrDatetime::date() | datetime(), Hours::integer()) -> datetime()

Adds the number of hours Hours to DateOrDatetime and returns a new datetime value.

add_minutes/1

add_minutes(Minutes::integer()) -> datetime()

Same as uef_time:add_seconds(Minutes * 60). See docs of uef_time:add_seconds/1.

add_minutes/2

add_minutes(DateOrDatetime::date() | datetime(), Minutes::integer()) -> datetime()

Adds the number of minutes Minutes to DateOrDatetime and returns a new datetime value.

add_months/1

add_months(Months::integer()) -> datetime()

Same as uef_time:add_months(erlang:localtime(), Months). See docs of uef_time:add_months/2.

add_months/2

add_months(DateOrDatetime::date() | datetime(), Months::integer()) -> NewDateOrDateTime::date() | datetime()

Adds the number of months Months to DateOrDatetime and returns a new date or datetime value. The type of NewDateOrDateTime is the same as the type of DateOrDatetime.

add_seconds/1

add_seconds(Seconds::integer()) -> datetime()

Same as uef_time:add_seconds(erlang:localtime(), Seconds). See docs of uef_time:add_seconds/2.

add_seconds/2

add_seconds(DateOrDatetime::date() | datetime(), Seconds::integer()) -> datetime()

Adds the number of seconds Seconds to DateOrDatetime and returns a new datetime value.

add_time/1

add_time(Periods::periods()) -> datetime()

Same as uef_time:add_time(erlang:localtime(), Periods).

add_time/2

add_time(DateOrDatetime::date() | datetime(), Tail::periods()) -> NewDateOrDateTime::date() | datetime()

Adds one or more periods of time to DateOrDatetime and returns a new date or datetime value.

add_weeks/1

add_weeks(Weeks::integer()) -> datetime()

Same as uef_time:add_seconds(Weeks * 604800). See docs of uef_time:add_seconds/1.

add_weeks/2

add_weeks(DateOrDatetime::date() | datetime(), Weeks::integer()) -> NewDateOrDateTime::date() | datetime()

Adds the number of weeks Weeks to DateOrDatetime and returns a new date or datetime value. The type of NewDateOrDateTime is the same as the type of DateOrDatetime.

add_years/1

add_years(Years::integer()) -> datetime()

Same as uef_time:add_years(erlang:localtime(), Years). See docs of uef_time:add_years/2.

add_years/2

add_years(DateOrDatetime::date() | datetime(), Years::integer()) -> NewDateOrDateTime::date() | datetime()

Adds the number of years Years to DateOrDatetime and returns a new date or datetime value. The type of NewDateOrDateTime is the same as the type of DateOrDatetime.

days_diff/1

days_diff(Date::date()) -> Days::integer()

Returns the difference in days between Date and the current local date provided by function erlang:date(). Date must be of type calendar:date() ({Year, Month, Day}). Days is a positive value if Date is after erlang:date() or a negative value otherwise.

days_diff/2

days_diff(Date1::date(), Date2::date()) -> Days::integer()

Returns the difference in days between Date2 and Date1. Date1 and Date2 must be of type calendar:date() ({Year, Month, Day}). Days is a positive value if Date2 is after Date1 or a negative value otherwise.

seconds_diff/1

seconds_diff(DateTime::datetime()) -> Seconds::integer()

Returns the difference in seconds between Date and the current local time provided by function erlang:localtime(). DateTime must be of type calendar:datetime() ({{Year, Month, Day}, {Hour, Minute, Second}}). Seconds is a positive value if DateTime is after erlang:localtime() or a negative value otherwise.

seconds_diff/2

seconds_diff(DateTime1::datetime(), DateTime2::datetime()) -> integer()

Returns the difference in seconds between DateTime2 and DateTime1. DateTime1 and DateTime2 must be of type calendar:datetime() ({{Year, Month, Day}, {Hour, Minute, Second}}). Seconds is a positive value if DateTime2 is after DateTime1 or a negative value otherwise.

today/0

today() -> CurrentDate::date()

Returns the current date as {Year, Month, Day}. Same as erlang:date(). CurrentDate is of type calendar:date().

tomorrow/0

tomorrow() -> TomorrowDate::date()

Returns tomorrow's date as {Year, Month, Day}. TomorrowDate is of type calendar:date().

unix_time/0

unix_time() -> Seconds::integer()

Returns the current number of seconds since 00:00:00 (UTC), 1 January 1970. It also known as Unix time or POSIX time or UNIX Epoch time.

unix_time/1

unix_time(Datetime::datetime()) -> Seconds::integer()

Returns the number of seconds elapsed between 00:00:00 (UTC), 1 January 1970 and Datetime. Datetime must be of type calenadr:datetime().

yesterday/0

yesterday() -> YesterdayDate::date()

Returns yesterday's date as {Year, Month, Day}. YesterdayDate is of type calendar:date().


Generated by EDoc