Use of th, sp and spth in date function
USE OF TH IN TO_CHAR FUNCTION
ddth places th, rd, nd for the date (dd) field.
SELECT TO_CHAR(SYSDATE, 'ddth-mon-yy') FROM dual
Output : 6TH-FEB-10
USE OF SP IN TO_CHAR FUNCTION
ddsp indicates that the date (dd) must be displayed by spelling the date such as one, fifteen etc
SELECT SYSDATE, TO_CHAR(SYSDATE, 'ddsp') FROM dual
Output : 6/2/2010, six
USE OF SPTH IN TO_CHAR FUNCTION
spth displays the date(dd) with ‘th’ added to the spelling of date.
SELECT TO_CHAR(SYSDATE, 'ddspth') FROM dual
OUTPUT : SIXTH
Filed Under: PLSQL - Date Manipulation