DAY()
Description
Returns the day of the month for date, in the range 1 to 31, or 0 for dates such as 0000-00-00 or 2008-00-00 that have a zero day part. Returns NULL if date is NULL.
Syntax
1. > DAY(date)
Arguments
| Arguments | Description |
|---|---|
| date | Required. The date/datetime to extract the date from. |
Examples
1. mysql> SELECT day('2007-02-03');
2. +-----------------+
3. | day(2007-02-03) |
4. +-----------------+
5. | 3 |
6. +-----------------+
7. 1 row in set (0.01 sec)
1. CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
2. INSERT INTO t3 VALUES('2000-01-01');
3. INSERT INTO t3 VALUES('1999-12-31');
4. INSERT INTO t3 VALUES('2000-01-01');
5. INSERT INTO t3 VALUES('2006-12-25');
6. INSERT INTO t3 VALUES('2008-02-29');
8. mysql> SELECT day(c1) from t3;
9. +---------+
10. | day(c1) |
11. +---------+
12. | 1 |
13. | 31 |
14. | 1 |
15. | 25 |
16. | 29 |
17. +---------+
18. 5 rows in set (0.01 sec)
