Bug #501 casting to date does not work properly
Submitted: 25 May 2003 17:02 Modified: 30 Sep 2008 8:41
Reporter: Christian Hammers (Silver Quality Contributor) (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:4.0.13 OS:Linux (Debian GNU/Linux)
Assigned to: CPU Architecture:Any

[25 May 2003 17:02] Christian Hammers
Description:
This bug is duplicate to #498 but I don't know how else to change the category
to "feature-request".

From the Debian Bug Tracking System. 
More information available at http://bugs.debian.org/190183. 
The bug was reported by Wichert Akkerman <wichert@wiggy.net>

MySQL does not implement casting to dates properly.

How to repeat:
mysql> select cast(now() as date);
+---------------------+
| cast(now() as date) |
+---------------------+
| 2003-04-22 16:51:15 |
+---------------------+
1 row in set (0.00 sec)

note that the time is not discarded as it should be. It should work
like this (example made using postgres):

template1=> select now(), cast(now() as date);
              now              |    now     
-------------------------------+------------
 2003-04-22 16:52:57.929235+02 | 2003-04-22
                                 ^^^^^^^^^^
[26 May 2003 6:17] Alexander Keremidarski
Please see comments for #498 which is same issue.
[30 Sep 2008 8:41] Konstantin Osipov
This appears to be fixed, at least in 6.0.8.
[30 Sep 2008 8:42] Konstantin Osipov
mysql>  select cast(now() as date);
+---------------------+
| cast(now() as date) |
+---------------------+
| 2008-09-30          | 
+---------------------+
1 row in set (0.00 sec)

mysql> select version();
+--------------------------------+
| version()                      |
+--------------------------------+
| 6.0.8-alpha-valgrind-max-debug | 
+--------------------------------+
1 row in set (0.00 sec)