SQLzoo.net

Components of a date: such as the year or the month

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

Related links:

  • DATES