How To Get YEARWEEK() To See Sunday As The Start Of The Week?

Posted by tan on Stack Overflow See other posts from Stack Overflow or by tan
Published on 2010-06-09T10:13:17Z Indexed on 2010/06/09 10:22 UTC
Read the original article Hit count: 140

Filed under:

I'm trying to get the YEARWEEK function to see Sunday as the 1st day of the week.

An example date is: Sunday 1st Mar 2009

Here is my sql

SELECT YEARWEEK('2009-03-01')

and the result is

-> 200909

Which is week 9. I believe it is telling me this is week 9 because it sees the sunday as the last day of the previous week.

How would I get this function to see sunday as the 1st day of the week and therefore return as week 10?

© Stack Overflow or respective owner

Related posts about mysql