In Oracle Database, we can use the TO_CHAR(datetime)
function to return the various date parts from a datetime value, including the short day name.
The short day name is also referred to as the abbreviated day name. In any case, below are examples of returning the short day name from a date value in Oracle.
Example
To get the abbreviated day name, use DY
:
SELECT TO_CHAR(DATE '2035-10-03', 'DY')
FROM DUAL;
Result:
WED
Capitalisation
In the above example I used uppercase DY
, which resulted in the short day name being returned in uppercase.
We can change the capitalisation of this argument to Dy
in order to return the result in a capitalised format.
SELECT TO_CHAR(DATE '2035-10-03', 'Dy')
FROM DUAL;
Result:
Wed
Alternatively, we can provide it in lowercase (dy
) to return the short day name in lowercase:
SELECT TO_CHAR(DATE '2035-10-03', 'dy')
FROM DUAL;
Result:
wed
There are many more format elements available for formatting datetime values in Oracle, and the above format element can be combined with others to produce a longer format model.
Example:
SELECT TO_CHAR(DATE '2035-10-03', 'Dy, dd Mon YYYY')
FROM DUAL;
Result:
Wed, 03 Oct 2035
See List of Datetime Format Elements in Oracle for a full list of format elements that can be used to construct a format model.