Page 1 of 1

Select only date from datetime?

Posted: Sat May 13, 2006 4:27 pm
by GeXus
Is there a function i should use to return the date only from a datetime field?

Posted: Sat May 13, 2006 4:39 pm
by hawleyjr
Yes, if you format your date with the mysql date_format() function you can group/sort/count by a specific date.

Posted: Sat May 13, 2006 7:08 pm
by raghavan20
date(yourdatetimefield)
ex:

Code: Select all

mysql> select date(now());
+-------------+
| date(now()) |
+-------------+
| 2006-05-14  |
+-------------+
1 row in set (0.03 sec)