MySQL Tutorial/Date Time Functions/CURDATE — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:44, 26 мая 2010
CURDATE()
Returns the current date as a value in "YYYY-MM-DD" or YYYYMMDD format, depending on whether the function is used in a string or numeric context.
CURRENT_DATE is the synonym for CURDATE().
mysql>
mysql> SELECT CURDATE();
+------------+
| CURDATE() |
+------------+
| 2007-07-22 |
+------------+
1 row in set (0.00 sec)
mysql> SELECT CURDATE() + 0;
+---------------+
| CURDATE() + 0 |
+---------------+
| 20070722 |
+---------------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql> select CURRENT_DATE();
+----------------+
| CURRENT_DATE() |
+----------------+
| 2007-07-22 |
+----------------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql>
Using CURDATE() function
mysql>
mysql> select CURDATE();
+------------+
| CURDATE() |
+------------+
| 2007-07-21 |
+------------+
1 row in set (0.00 sec)
mysql>