This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem with SQL DATE() function.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem with SQL DATE() function.." Watch "Problem with SQL DATE() function.." New topic
Author

Problem with SQL DATE() function..

Ivan Jouikov
Ranch Hand

Joined: Jul 22, 2003
Posts: 269
DATE() and related functions don't seem to work:
->SELECT TIMESTAMP('2003-12-31');
[Comp Root] ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('2003-12-31')' at line 1
->SELECT DATE('2003-12-31 01:02:03');
[Comp Root] ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('2003-12-31 01:02:03')' at line 1
However things like SELECT DAYOFWEEK('1998-02-03'); do work... any ideas?
I am using MySQL latest stable release
Faisal Khan
Ranch Hand

Joined: Jun 29, 2003
Posts: 285
Hi Ivan,
The DATE() and TIMESTAMP() functions are not available in latest stable releases. These functions are available in 4.1.1 (which is Alpha at the moment). This is clearly stated in the MySQL Manual.
Furthermore, you have posted this question in the wrong place, since this has nothing to do with servlets.
For details read: http://www.mysql.com/doc/en/Date_and_time_functions.html
HTH


The secret to creativity is knowing how to hide your sources.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Moving from Servlets to JDBC.
 
GeeCON Prague 2014
 
subject: Problem with SQL DATE() function..