Is there a way in MySQL to select rows which fall on a specific day, as in Mondays, using a date column?
+2
A:
Look up the DAYOFWEEK() function here in the MySQL Online Docs
Grant Limberg
2008-11-18 00:53:59
This will probably result in this query turning into a full table scan, as the db will need to run dayofweek() on all rows before it knows which of them match the condition. Consider storing the day of the week explicitly in another column if this table is big.
Jon Topper
2008-11-20 17:00:41
+1
A:
I assume you mean a specific Week Day Name, yes there is:
In mysql you can use DAYOFWEEK() - check the manual
In PHP you can use getdate() and for example do:
$date = getdate(); $weekday = $date[weekday]; - check the manual
tharkun
2008-11-18 00:57:35