DAY()
Function Description
Returns the number of the month that date is 1 to 31; for dates such as 0000-00-00 or 2008-00-00, return 0. Returns NULL if the date is NULL.
Function Syntax
> DAY(date)
Parameter definition
| Parameters | Description |
|---|---|
| date | Required parameters. The date parameter is a legal date expression. |
Example
mysql> SELECT day('2007-02-03');
+-----------------------+
| day(2007-02-03) |
+-----------------------+
| 3 |
+-----------------------+
1 row in set (0.01 sec)
CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('1999-12-31');
INSERT INTO t3 VALUES('2000-01-01');
INSERT INTO t3 VALUES('2006-12-25');
INSERT INTO t3 VALUES('2008-02-29');
mysql> SELECT day(c1) from t3;
+-----------+
| day(c1) |
+-----------+
| 1 |
| 31 |
| 1 |
| 25 |
| 29 |
+-----------+
5 rows in set (0.01 sec)