leap_year(+Year)

Determine if a specified year is a leap year or not. This predicate succeeds and is exited if the year is a leap year (366 days), else it fails. A leap year is a year that can be divided by 4, but not if it can be divided by 100, but is if it can be divided by 400.

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 length_month/3 monday_of_week/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
leap_year(1996). the predicate is exited because 1996 was a leap year
leap_year(1997). fails because 1997 was not a leap year
leap_year(2000). the predicate is exited because 2000 was a leap year

 

 

info@trinc-prolog.com