I am running an SQL select query against a third party VFP database table. Here is what the. Not date & time. The date field is of data type DATETIME and is.
-->The following table lists ODBC time and date functions supported by the Visual FoxPro ODBC Driver; when the Visual FoxPro grammar for the same function differs from the ODBC syntax, the Visual FoxPro equivalent is listed.
ODBC grammar | Visual FoxPro grammar |
---|---|
CURDATE*( )* | DATE*( )* |
CURTIME*( )* | TIME*( )* |
DAYNAME*(date_exp)* | CDOW*(date_exp)* |
DAYOFMONTH(date_exp) | DAY*( )* |
HOUR*(time_exp)* | |
MINUTE*(time_exp)* | |
MONTH*(time_exp)* | |
MONTHNAME*(date_exp)* | CMONTH*(date_exp)* |
NOW*( )* | DATETIME*( )* |
SECOND*(time_exp)* | SEC*(time_exp)* |
WEEK*(date_exp)* | |
YEAR*(date_exp)* |
The following time and date functions are not supported:
DAYOFYEAR (date_exp)
QUARTER (date_exp)
TIMESTAMPADD (interval, integer_exp, timestamp_exp)
![Date Date](http://spacefold.com/colin/archive/articles/sql_backend/a1.gif)
TIMESTAMPDIFF (interval, timestamp_exp1, timestamp_exp2)
ODBC Escape Sequences
The driver also supports the ODBC escape sequence for date and timestamp data. The escape clause syntax is as follows:
In this syntax, d indicates that value is a date in the yyyy-mm-dd format and ts indicates that value is a timestamp in the yyyy-mm-dd hh:mm:ss[.f...] format. The shorthand syntax for date and timestamp data is as follows:
For example, each of the following statements updates the ALLTYPES table by using the date and timestamp shorthand syntax in a supported SQL UPDATE command:
Remarks
For more information about escape sequences, see Escape Sequences in ODBC in the ODBC Programmer's Reference.