O'Reilly logo

Sams Teach Yourself MySQL by Chris Newman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required