Select only date from datetime?
Moderator: General Moderators
Select only date from datetime?
Is there a function i should use to return the date only from a datetime field?
Yes, if you format your date with the mysql date_format() function you can group/sort/count by a specific date.
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
date(yourdatetimefield)
ex:
ex:
Code: Select all
mysql> select date(now());
+-------------+
| date(now()) |
+-------------+
| 2006-05-14 |
+-------------+
1 row in set (0.03 sec)