From 7c94e6f3a69462968cfd352fb40389454bd42e7e Mon Sep 17 00:00:00 2001 From: Imre Horvath Date: Tue, 14 Dec 2010 23:03:44 +0100 Subject: Add ISO week number calculation functions to the calendar module in stdlib This new feature adds the missing week number function to the calendar module of the stdlib application. The implementation conforms to the ISO 8601 standard. The new feature has been implemented tested and documented. --- lib/stdlib/doc/src/calendar.xml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/calendar.xml b/lib/stdlib/doc/src/calendar.xml index 36f0c03162..f90d8308b6 100644 --- a/lib/stdlib/doc/src/calendar.xml +++ b/lib/stdlib/doc/src/calendar.xml @@ -63,6 +63,14 @@ given as local time, they must be converted to universal time, in order to get the correct value of the elapsed time between epochs. Use of the function time_difference/2 is discouraged.

+

There exists different definitions for the week of the year. + The calendar module contains a week of the year implementation + which conforms to the ISO 8601 standard. Since the week number for + a given date can fall on the previous, the current or on the next + year it is important to provide the information which year is it + together with the week number. The function iso_week_number/0 + and iso_week_number/1 returns a tuple of the year and the + week number.

@@ -153,6 +161,30 @@ time() = {Hour, Minute, Second}

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 + actual date, the function local_time/0 is used.

+
+
+ + 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 -- cgit v1.2.3