The "typical" SQL DBMS supports date, time and timestamp data types but interval (as a separate data type) is not common yet. The majority of SQL DBMSs can't handle time zones, can't handle fractional seconds and can't handle leap seconds. For example, the Oracle DATE data type is typically a timestamp (i.e.: it includes both a date portion and a time portion, despite the name) with no fractional seconds, formatted as DD-MON-YY (e.g.: 06-JAN-97). Valid dates fall into the range January 1 4712 B.C. to December 31 4712 A.D. Intervals are expressed only as integers, representing number of days. The Oracle SYSDATE function returns the current date and the current time.
ODBC has several datetime functions; most are replaceable with standard SQL. Here are the different names to expect.
| Standard | ODBC |
|---|---|
CURRENT_DATE | CURDATE |
CURRENT_TIME | CURTIME |
CURRENT_TIMESTAMP | NOW |
EXTRACT(MONTH ... | MONTH |
(EXTRACT(MONTH...)/4 | QUARTER |
EXTRACT(DAY ... | DAYOFMONTH |
not supported | DAYOFWEEK |
not supported | DAYOFYEAR |
EXTRACT(HOUR ... | HOUR |
EXTRACT(MINUTE ... | MINUTE |
EXTRACT(SECOND ... | SECOND |