Return the day of the week by number: DAYOFWEEK() : DAYOFWEEK « Date Time « SQL / MySQL






Return the day of the week by number: DAYOFWEEK()

     
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)

   
    
    
    
    
  








Related examples in the same category

1.Table shows the DAYOFWEEK( ) expressions to use for putting any day of the week first in the sort order
2.DAYOFWEEK( ) returns values from 1 to 7, corresponding to Sunday through Saturday.
3.Sorting by Day of Week
4.To produce a day-of-week summary instead, use the DAYOFWEEK( ) function: