MySQL Tutorial/Date Time Functions/LAST DAY — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:44, 26 мая 2010
Содержание
LAST_DAY(date) returns the corresponding value for the last day of the month.
Returns NULL if the argument is invalid.
mysql>
mysql> SELECT LAST_DAY("2003-02-05");
+------------------------+
| LAST_DAY("2003-02-05") |
+------------------------+
| 2003-02-28 |
+------------------------+
1 row in set (0.00 sec)
mysql>
mysql>
SELECT LAST_DAY("2003-03-32");
mysql>
mysql> SELECT LAST_DAY("2003-03-32");
+------------------------+
| LAST_DAY("2003-03-32") |
+------------------------+
| NULL |
+------------------------+
1 row in set, 1 warning (0.00 sec)
mysql>
SELECT LAST_DAY("2004-01:01");
mysql>
mysql> SELECT LAST_DAY("2004-01-01 01:01:01");
+---------------------------------+
| LAST_DAY("2004-01-01 01:01:01") |
+---------------------------------+
| 2004-01-31 |
+---------------------------------+
1 row in set (0.00 sec)
mysql>
SELECT LAST_DAY("2004-02-05");
mysql>
mysql> SELECT LAST_DAY("2004-02-05");
+------------------------+
| LAST_DAY("2004-02-05") |
+------------------------+
| 2004-02-29 |
+------------------------+
1 row in set (0.00 sec)
mysql>