monday_of_week(+Year, +WeekNumber, ?DateNumber)

Calculate the date (year, month, day) for a Monday of a certain week in a year, input parameters are the first two parameters (year and a week number), the last parameter is the calculated date number for the Monday of the week.

This predicate is located in the file 'datetime.txt', use ensure_loaded/1 to include this file.

see also: age/7 day_number/4 day_of_week/2 datetime module decode_date/4 decode_datetime/7 decode_time/4 encode_date/4 encode_datetime/7 encode_time/2 encode_time/3 encode_time/4 ensure_loaded/1 first_week/2 leap_year/1 length_month/3 monday_of_week/5 next_week/4 num_weeks_in_year/2 prev_week/4 reverse_day_number/4 start_of_week/3

Example
monday_of_week(1998, 1, D). succeeds and the calculated date number is:
D = 729387
monday_of_week(1998, 2, D). succeeds and the calculated date number is:
D = 729394
monday_of_week(1998, 2, 729395). fails because the calculated date number is 729394 and the value of the last parameter is 729395

 

Exceptions  
The Year and/or WeekNumber parameters are not an integer a type_error(evaluable, Value) exception is thrown, Value is unified with the incorrect argument
The last parameter is not an integer nor a variable a type_error(evaluable, Value) exception is thrown, Value is unified with the incorrect argument

 

 

info@trinc-prolog.com