num_weeks_in_year(+Year, ?NumWeeks)

Calculate the number of weeks a year has. The first parameter is the year for which the number of weeks must be determined.

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 leap_year/1 length_month/3 monday_of_week/3 monday_of_week/5 reverse_day_number/4 start_of_week/3

Example
num_weeks_in_year(1998, Num). succeeds,
Num = 53
num_weeks_in_year(1999, Num). succeeds,
Num = 52
num_weeks_in_year(1998, 52). fails, because 1998 has 53 weeks 

 

Exceptions  
The Year parameter is not an integer a type_error(evaluable, Value) exception is thrown, Value is unified with the incorrect argument

 

 

info@trinc-prolog.com