At 2:26 PM -0500 7/28/99, Steve Ruby wrote:
>The other ODBC WEEK() functions I am familiar with
>break weeks up as follows
>
>Weekstart = Sunday
>Weekend = Saturday
>
>January 1 to the first Sunday is Week 1
>
>It appears that the WEEK() function in MysQL
>may use
>
>WeekStart = Monday
>Weekend = Sunday
>
>If the Jan 1 is not Monday then jan 1 to
>the first Sunday is week 53.
>
>I believe this may be a difference in thinking
>between Europe and America as far as dates are
>concerned.
>
>Is there a way around this? If not is is possible
>to implement a variation on the WEEK() function
>that does it the other way?
You can pick the way you want. From the manual:
@findex WEEK()
@item WEEK(date)
@itemx WEEK(date,first)
With a single argument, returns the week for @code{date}, in the range
@code{0} to @code{52}, for locations where Sunday is the first day of the week.
The two-argument form of @code{WEEK()} allows you to specify whether the
week starts on Sunday or Monday. The week starts on Sunday if the second
argument is @code{0}, on Monday if the second argument is @code{1}.
@example
mysql> select WEEK('1998-02-20');
-> 7
mysql> select WEEK('1998-02-20',0);
-> 7
mysql> select WEEK('1998-02-20',1);
-> 8
@end example
--
Paul DuBois, paul@stripped