Database Reference
In-Depth Information
Table 11.2 WEEKDAY returned values.
Day
Value returned
Monday
0
Tuesday
1
Wednesday
2
Thursday
3
Friday
4
Saturday
5
Sunday
6
To obtain the numeric weekday for today, you would issue the following query:
SELECT
WEEKDAY( NOW() )
Figure 11.6 shows the results from that query. You can see that the day is Monday and its
WEEKDAY VALUE is therefore 0.
DAYOFMONTH
The DAYOFMONTH() function returns the day number of a given month. We use the func-
tion as follows:
DAYOFMONTH( aDate )
By passing the output of the NOW() function into DAYOFMONTH, you can obtain the
current day number. Figure 11.7 shows this at the time of writing, which is 23 December.
DAYOFYEAR
The DAYOFYEAR() function returns a count of the number of days since 1 January for a
given date. We use the function as follows:
DAYOFYEAR( aDate )
Figure 11.6
DAYNAME(), DAYOFWEEK() and WEEKDAY().
Search WWH ::




Custom Search