Mega Code Archive

 
Categories / MySQL / Date Time
 

Return the day of the week by number

mysql> mysql> mysql> SELECT DAYOFWEEK('2004-12-31 23:59:59'); +----------------------------------+ | DAYOFWEEK('2004-12-31 23:59:59') | +----------------------------------+ |                                6 | +----------------------------------+ 1 row in set (0.00 sec)