[MySQL] Кто-нить знает, как получить седняшнюю дату?

gidral

Не подскажите, каким запросом получают текущую дату?
Вот


select date;


выдает ошибку, а с


select now;
+-------------------------------+
| now |
+-------------------------------+
| 2004-01-31 19:21:25 |
+-------------------------------+


все нормально.

sergei1969

http://www.hackers/docs/mysql/manual.html#Date_and_time_types

CURDATE
CURRENT_DATE
Returns today's date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on whether the function is used in a string or numeric context:
mysql> select CURDATE;
-> '1997-12-15'
mysql> select CURDATE + 0;
-> 19971215
CURTIME
CURRENT_TIME
Returns the current time as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context:
mysql> select CURTIME;
-> '23:50:26'
mysql> select CURTIME + 0;
-> 235026
NOW
SYSDATE
CURRENT_TIMESTAMP
Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context:
mysql> select NOW;
-> '1997-12-15 23:50:26'
mysql> select NOW + 0;
-> 19971215235026
UNIX_TIMESTAMP
UNIX_TIMESTAMP(date)
If called with no argument, returns a Unix timestamp (seconds since '1970-01-01 00:00:00' GMT). If UNIX_TIMESTAMP is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' GMT. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD in local time:
mysql> select UNIX_TIMESTAMP;
-> 882226357
mysql> select UNIX_TIMESTAMP('1997-10-04 22:23:00');
-> 875996580

gidral

Спасибо.
Оставить комментарий
Имя или ник:
Комментарий: