0

I have the week number and year as separate fields in MySQL, how do I compute the last day of the week(Sunday) in the given year?

DidIReallyWriteThat
  • 1,033
  • 1
  • 10
  • 39
Pentium10
  • 204,586
  • 122
  • 423
  • 502
  • 1
    See [this](http://stackoverflow.com/questions/3317980/getting-first-day-of-the-week-in-mysql-using-week-no) or [this](http://stackoverflow.com/questions/3707347/mysql-week-date-range-from-week-number-in-a-query)... – pascal Sep 22 '10 at 08:08

1 Answers1

1
SELECT STR_TO_DATE('201038 Sunday', '%X%V %W');

This gives you sunday of the current week (38/2010). I used sunday because the "last day" is not consistend. sometimes its sunday, sometimes saturday (week starts on monday)...

The Surrican
  • 29,118
  • 24
  • 122
  • 168