WEEKS(date_exp)

Absolute Week Numbers. Returns the week of the year based on the week field in date_exp as an integer value in the range of 1-53.

 

An absolute week number is the seven day period that a date falls within, based solely on the first day of the year, regardless of the day of the week.

 

Week 1 is always January 1st to January 7th; week 2 is always January 8th to January 14th, and so on. If the year begins on a Thursday, then each "week" is from Thursday to the following Wednesday.

 

The absolute week number will always be between 1 and 53. Week 53 will have either one or two days, depending on whether the year is a leap year. If the year is a not a leap year, week 53 will consist of one day: December 31st. If the year is a leap year, week 53 will consist of two days: December 30th and December 31st.

 

Example:

SELECT WEEKS({d '2006-11-19'}) returns 47

 

The results of the SQL expression are shown in the fourth column.

weeknumbers2.JPG