Copyright © 2010 David Weldon Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Authors: David Weldon.
date() = {year(), month(), day()}
day() = 1..31
month() = 1..12
period() = day | days | week | weeks | month | months | year | years
year() = non_neg_integer()
| beginning_of_month/1 | Returns the first date of the month containing Date. |
| date_to_string/1 | Returns an ISO 8601 representation of Date. |
| day_of_week/1 | Returns the day of the week as a string ("monday".."sunday") for Date. |
| easter/1 | Returns the date for Easter (Roman Catholic) in Year. |
| end_of_month/1 | Returns the last date of the month containing Date. |
| is_after/2 | Returns true if Date1 is after Date2, and false otherwise. |
| is_before/2 | Returns true if Date1 is before Date2, and false otherwise. |
| is_in_future/1 | Returns true if Date is in the future, and false otherwise. |
| is_in_past/1 | Returns true if Date is in the past, and false otherwise. |
| shift/2 | Returns a new date after shifting today's date by N periods. |
| shift/3 | Returns a new date after shifting Date by N periods. |
| string_to_date/1 | Converts String to a date. |
| subtract/2 | Returns Date1 - Date2 as an integer number of days. |
| today/0 | Returns today's date. |
| tomorrow/0 | Returns tomorrow's date. |
| yesterday/0 | Returns yesterday's date. |
Returns the first date of the month containing Date.
> edate:beginning_of_month({2010,2,15}).
{2010,2,1}
date_to_string(X1::date()) -> string()
Returns an ISO 8601 representation of Date.
> edate:date_to_string({1976,3,18}).
"1976-03-18"
day_of_week(Date::date()) -> string()
Returns the day of the week as a string ("monday".."sunday") for Date.
> edate:day_of_week({2010,7,4}).
"sunday"
Returns the date for Easter (Roman Catholic) in Year. Derived from
http://www.gmarts.org/index.php?go=415#geteasterdatec.
> edate:easter(2010).
{2010,4,4}
Returns the last date of the month containing Date.
> edate:end_of_month({2010,2,15}).
{2010,2,28}
Returns true if Date1 is after Date2, and false otherwise.
> edate:is_after({1950,7,2}, {1950,7,1}).
true
Returns true if Date1 is before Date2, and false otherwise.
> edate:is_before({1950,7,1}, {1950,7,2}).
true
is_in_future(Date::date()) -> boolean()
Returns true if Date is in the future, and false otherwise.
> edate:is_in_future({3000,7,1}).
true
is_in_past(Date::date()) -> boolean()
Returns true if Date is in the past, and false otherwise.
> edate:is_in_past({1950,7,1}).
true
Returns a new date after shifting today's date by N periods.
Returns a new date after shifting Date by N periods.
> edate:shift({2000,1,1}, -2, days).
{1999,12,30}
> edate:shift({2010,2,27}, 1, week).
{2010,3,6}
string_to_date(String::string()) -> date()
Converts String to a date. The following string formats are valid
(with or without zero-padding):
YYYY-MM-DD, YYYY/MM/DD, MM-DD-YYYY, MM/DD/YYYY.
> edate:string_to_date("1976-03-18").
{1976,3,18}
> edate:string_to_date("3/18/1976").
{1976,3,18}
Returns Date1 - Date2 as an integer number of days. The number of
days returned will be positive if Date1 > Date2.
> edate:subtract({2010,7,4}, {2010,7,1}).
3
> edate:subtract({2010,7,1}, {2010,7,4}).
-3
today() -> date()
Returns today's date.
tomorrow() -> date()
Returns tomorrow's date.
yesterday() -> date()
Returns yesterday's date.
Generated by EDoc