Date Functions
MySQL includes a range of functions for manipulating date and time values. You learn the most useful functions in this section.
Date Functions
Refer to the online manual for the full list of date and time functions: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html. |
Returning the Current Date and Time
The MySQL function CURDATE() returns the current date; CURTIME() returns the current time, as shown in the following example:
mysql> SELECT CURDATE(), CURTIME(); +------------+-----------+ | CURDATE() | CURTIME() | +------------+-----------+ | 2005-10-28 | 16:24:45 | +------------+-----------+ 1 row in set (0.01 ...
Get Sams Teach Yourself MySQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.