Again, in MySql you can use a function which does this in the SQL query:
Code:
SELECT DATE_FORMAT(date, '%U');
The DATE_FORMAT() function is documented fully here.