From 229d0d8ca88bc344bed89e46541b325c1d267996 Mon Sep 17 00:00:00 2001
From: Hans Bolinder
Date: Fri, 6 May 2011 15:58:09 +0200
Subject: r Use Erlang specs and types for documentation
---
lib/stdlib/doc/src/calendar.xml | 226 +++++++++++++++++++---------------------
1 file changed, 106 insertions(+), 120 deletions(-)
(limited to 'lib/stdlib/doc/src/calendar.xml')
diff --git a/lib/stdlib/doc/src/calendar.xml b/lib/stdlib/doc/src/calendar.xml
index 075c7f9c78..4876b37127 100644
--- a/lib/stdlib/doc/src/calendar.xml
+++ b/lib/stdlib/doc/src/calendar.xml
@@ -73,100 +73,125 @@
week number.
-
- DATA TYPES
-
-date() = {Year, Month, Day}
- Year = int()
- Month = 1..12
- Day = 1..31
-Year cannot be abbreviated. Example: 93 denotes year 93, not 1993.
-Valid range depends on the underlying OS.
-The date tuple must denote a valid date.
+
+
+
+
+
+
+
+
+
+
+
+
+ Year cannot be abbreviated. Example: 93 denotes year
+ 93, not 1993. Valid range depends on the underlying OS. The
+ date tuple must denote a valid date.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ See erlang:now/0.
+
+
+
+
+
+
+
+
+
-time() = {Hour, Minute, Second}
- Hour = 0..23
- Minute = Second = 0..59
-
- date_to_gregorian_days(Date) -> Days
- date_to_gregorian_days(Year, Month, Day) -> Days
+
+
+
+
+
+
Compute the number of days from year 0 up to the given date
-
- Date = date()
- Days = int()
-
This function computes the number of gregorian days starting
with year 0 and ending at the given date.
- datetime_to_gregorian_seconds({Date, Time}) -> Seconds
+
Compute the number of seconds from year 0 up to the given date and time
-
- Date = date()
- Time = time()
- Seconds = int()
-
This function computes the number of gregorian seconds
starting with year 0 and ending at the given date and time.
- day_of_the_week(Date) -> DayNumber
- day_of_the_week(Year, Month, Day) -> DayNumber
+
+
Compute the day of the week
-
- Date = date()
- DayNumber = 1..7
-
+
+
+
+
- This function computes the day of the week given Year,
- Month and Day. The return value denotes the day
+
This function computes the day of the week given Year,
+ Month and Day. The return value denotes the day
of the week as 1: Monday, 2: Tuesday, and so on.
- gregorian_days_to_date(Days) -> Date
+
Compute the date given the number of gregorian days
-
- Days = int()
- Date = date()
-
This function computes the date given the number of
gregorian days.
- gregorian_seconds_to_datetime(Seconds) -> {Date, Time}
+
Compute the date given the number of gregorian days
-
- Seconds = int()
- Date = date()
- Time = time()
-
This function computes the date and time from the given
number of gregorian seconds.
- is_leap_year(Year) -> bool()
+
Check if a year is a leap year
This function checks if a year is a leap year.
- iso_week_number() -> IsoWeekNumber
+
Compute the iso week number for the actual date
-
- IsoWeekNumber = {int(), int()}
-
This function returns the tuple {Year, WeekNum} representing
the iso week number for the actual date. For determining the
@@ -174,42 +199,34 @@ time() = {Hour, Minute, Second}
- iso_week_number(Date) -> IsoWeekNumber
+
Compute the iso week number for the given date
-
- Date = date()
- IsoWeekNumber = {int(), int()}
-
This function returns the tuple {Year, WeekNum} representing
the iso week number for the given date.
- last_day_of_the_month(Year, Month) -> int()
+
Compute the number of days in a month
This function computes the number of days in a month.
- local_time() -> {Date, Time}
+
Compute local time
-
- Date = date()
- Time = time()
-
This function returns the local time reported by
the underlying operating system.
- local_time_to_universal_time({Date1, Time1}) -> {Date2, Time2}
+
Convert from local time to universal time (deprecated)
This function converts from local time to Universal
- Coordinated Time (UTC). Date1 must refer to a local
+ Coordinated Time (UTC). DateTime1 must refer to a local
date after Jan 1, 1970.
This function is deprecated. Use
@@ -222,15 +239,11 @@ time() = {Hour, Minute, Second}
- local_time_to_universal_time_dst({Date1, Time1}) -> [{Date, Time}]
+
Convert from local time to universal time(s)
-
- Date1 = Date = date()
- Time1 = Time = time()
-
This function converts from local time to Universal
- Coordinated Time (UTC). Date1 must refer to a local
+ Coordinated Time (UTC). DateTime1 must refer to a local
date after Jan 1, 1970.
The return value is a list of 0, 1 or 2 possible UTC times:
@@ -258,65 +271,48 @@ time() = {Hour, Minute, Second}
- now_to_local_time(Now) -> {Date, Time}
+
Convert now to local date and time
-
- Now -- see erlang:now/0
- Date = date()
- Time = time()
-
This function returns local date and time converted from
the return value from erlang:now().
- now_to_universal_time(Now) -> {Date, Time}
- now_to_datetime(Now) -> {Date, Time}
+
+
Convert now to date and time
-
- Now -- see erlang:now/0
- Date = date()
- Time = time()
-
This function returns Universal Coordinated Time (UTC)
converted from the return value from erlang:now().
- seconds_to_daystime(Seconds) -> {Days, Time}
+
Compute days and time from seconds
-
- Seconds = Days = int()
- Time = time()
-
This function transforms a given number of seconds into days,
- hours, minutes, and seconds. The Time part is always
- non-negative, but Days is negative if the argument
- Seconds is.
+ hours, minutes, and seconds. The Time part is always
+ non-negative, but Days is negative if the argument
+ Seconds is.
- seconds_to_time(Seconds) -> Time
+
Compute time from seconds
-
- Seconds = int() < 86400
- Time = time()
-
+
This function computes the time from the given number of
- seconds. Seconds must be less than the number of
+ seconds. Seconds must be less than the number of
seconds per day (86400).
- time_difference(T1, T2) -> {Days, Time}
+
Compute the difference between two times (deprecated)
- This function returns the difference between two {Date, Time} tuples. T2 should refer to an epoch later
- than T1.
+ This function returns the difference between two {Date, Time} tuples. T2 should refer to an epoch later
+ than T1.
This function is obsolete. Use the conversion functions for
gregorian days and seconds instead.
@@ -324,24 +320,17 @@ time() = {Hour, Minute, Second}
- time_to_seconds(Time) -> Seconds
+
Compute the number of seconds since midnight up to the given time
-
- Time = time()
- Seconds = int()
-
+
This function computes the number of seconds since midnight
up to the specified time.
- universal_time() -> {Date, Time}
+
Compute universal time
-
- Date = date()
- Time = time()
-
This function returns the Universal Coordinated Time (UTC)
reported by the underlying operating system. Local time is
@@ -349,25 +338,22 @@ time() = {Hour, Minute, Second}
- universal_time_to_local_time({Date1, Time1}) -> {Date2, Time2}
+
Convert from universal time to local time
-
- Date1 = Date2 = date()
- Time1 = Time2 = time()
-
This function converts from Universal Coordinated Time (UTC)
- to local time. Date1 must refer to a date after Jan 1,
+ to local time. DateTime must refer to a date after Jan 1,
1970.
- valid_date(Date) -> bool()
- valid_date(Year, Month, Day) -> bool()
+
+
+
+
+
+
Check if a date is valid
-
- Date = date()
-
This function checks if a date is a valid.
--
cgit v1.2.3