Search code examples
leap-year

php - mySQL select date week for year


I have 1 column contains the date format

date:
2013-09-22
2013-09-23
2013-09-24
2013-09-25
2013-09-26
2013-09-27
2013-09-28
2013-09-29
2013-09-30
2013-10-01
2013-10-02

Today is the 40th week of the year. I want to select all days have 40 weeks to do the like. Looking forward to your help


Solution

  • Use the mysql function date_format.

    select * from tableOne where date_format(myField,'%U')=40;
    

    See MySql documentation