Components of a date: such as the year or the month
SQLite
We can extract the year, the month, the day of the month and the
day of the week. Times may be extracted in a similar way.
The SQL Standard specifies the understandably unpopular
EXTRACT
function.
Specific to SQLite
none
DB2
We can extract the year, the month, the day of the month and the
day of the week. Times may be extracted in a similar way.
The SQL Standard specifies the understandably unpopular
EXTRACT
function.
Specific to DB2
none
MS Access
We can extract the year, the month, the day of the month and the
day of the week. Times may be extracted in a similar way.
The SQL Standard specifies the understandably unpopular
EXTRACT
function.
Specific to MS Access
none
PostgreSQL
We can extract the year, the month, the day of the month and the
day of the week. Times may be extracted in a similar way.
The SQL Standard specifies the understandably unpopular
EXTRACT
function.
Specific to PostgreSQL
In addition to the standard postgres supports the DATE_PART function.
Oracle
We can extract the year, the month, the day of the month and the
day of the week. Times may be extracted in a similar way.
The SQL Standard specifies the understandably unpopular
EXTRACT
function.
Specific to Oracle
In addition to the standard Oracle has TO_CHAR.
The TO_CHAR function can be used to convert a date into a string. The second
parameter specifies the format. The following code may be used in the format
string:
YYYY
Four digit year
MS SQL Server
We can extract the year, the month, the day of the month and the
day of the week. Times may be extracted in a similar way.
The SQL Standard specifies the understandably unpopular
EXTRACT
function.
Specific to MS SQL Server
none
MySQL
We can extract the year, the month, the day of the month and the
day of the week. Times may be extracted in a similar way.
The SQL Standard specifies the understandably unpopular
EXTRACT
function.
Specific to MySQL
Other functions...
DAYOFMONTH DAYOFWEEK DAYOFYEAR
DAYNAME HOUR MINUTE MONTH MONTHNAME QUARTER SECOND
WEEK WEEKDAY YEAR YEARWEEK
Sybase
We can extract the year, the month, the day of the month and the
day of the week. Times may be extracted in a similar way.
The SQL Standard specifies the understandably unpopular
EXTRACT
function.
Specific to Sybase
none
Mimer SQL
We can extract the year, the month, the day of the month and the
day of the week. Times may be extracted in a similar way.
The SQL Standard specifies the understandably unpopular
EXTRACT
function.