This clause calculates the number of days elapsed from the date, specified by (Year, Month, Day), since the start of that same Year. A day number is defined as the number of days since January 1 of the same Year. A day number is not equal to a date number, a date number uniquely identifies a day since 1-1-1.
This predicate is located in the file 'datetime.txt', use ensure_loaded/1 to include this file.
see also: age/7 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/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 | |
| day_number(1998, 1, 1, DayNum). | the day number for the first day of a year is 1, this number
is unified with the parameter DayNum, DayNum = 1 |
| day_number(2000, 1, 31, 31). | succeeds because the daynumber for 31 Jan 2000 is 31. |
| day_number(2000, 12, 31, DayNum). | the day number for the last day of the year 2000 is 366, this
number is unified with DayNum, DayNum = 366 |
| day_number(2000, 12, 31, 377). | fails, the day number for the last day of the year 2000 is 366, this number cannot be unified with the value 377 |
| Exceptions | |
| A parameter is not an integer | a type_error(evaluable, Value) exception is thrown, Value is unified with the incorrect argument |