Database Reference
In-Depth Information
Figure 11.5
MONTHNAME() outputting the log table.
DAYOFWEEK
DAYOFWEEK() will return a number based on the day that the current date falls on from
Table 11.1.
Table 11.1
DAYOFWEEK returned values.
Day
Value returned
Sunday
1
Monday
2
Tuesday
3
Wednesday
4
Thursday
5
Friday
6
Saturday
7
DAYOFWEEK needs you to pass it an object with a date component, as with other date
functions that we have discussed previously. To obtain the numeric day of the week for
today, you would issue the following query:
SELECT
DAYOFWEEK( NOW() )
Figure 11.6 shows the results from that query. You can see that the day is Monday and its
DAYOFWEEK value is therefore 2.
WEEKDAY
WEEKDAY() works in a similar way as DAYOFWEEK() except it indexes the day names in
a different way. It returns values for the day of the week based on the values in Table 11.2.
 
Search WWH ::




Custom Search