DETERMINATION OF THE CALENDAR ORDINAL DATE

GIVEN THE CALENDAR WEEK DATE

 

Aristeo Canlas Fernando

 

To determine the calendar ordinal date (YYYY-DDD or YYYYDDD) given the calendar week date (YYYY-Www-D or YYYYWwwD), determine first if year is a common year or a leap year.  A leap year is a year that is divisible by 4 except century year which should be divisible by 400.

 

Common Year

  1. Subtract 1 from week number (ww) to get the difference.
  2. Multiply the difference by 7 to get the product.
  3. Add product to week day number (D) to get the ordinal date number (DDD).
  4. Append the ordinal date number to year (YYYY) to get the calendar ordinal date (YYYYDDD).

 

D is 8 for December 31 only.

 

Leap Year

 

  1. Subtract 1 from week number (ww) to get the difference.
  2. Multiply the difference by 7 to get the product.
  3. Add product to week day number (D) to get the ordinal date number (DDD).
  4. If week number is more than 26, add 1 to the sum in step 3 to get the ordinal date number (DDD).
  5. Append the ordinal date number to year (YYYY) to get the calendar ordinal date (YYYYDDD).

 

D is 8 for December 31 and June 31 only.

 

File:  findorddate.htm                 Date first uploaded:  2007 September 3       Rev. 0