mysql> select curdate(); +------------+ | curdate() | +------------+ | 2019-08-04 | +------------+ 1 row in set (0.00 sec) mysql> select date(now()); +-------------+ | date(now()) | +-------------+ | 2019-08-04 | +-------------+ 1 row in set (0.00 sec) mysql> select year(curdate()); +-----------------+ | year(curdate()) | +-----------------+ | 2019 | +-----------------+ 1 row in set (0.00 sec) mysql> select month(curdate()); +------------------+ | month(curdate()) | +------------------+ | 8 | +------------------+ 1 row in set (0.00 sec) mysql> select day(curdate()); +----------------+ | day(curdate()) | +----------------+ | 4 | +----------------+ 1 row in set (0.00 sec)
参考: