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

Share Article/Example:
  • DotNetKicks
  • DZone
  • StumbleUpon
  • Print
  • Add to favorites
  • Digg
  • del.icio.us
  • Twitter
  • Facebook
  • LinkedIn
  • Posterous
  • Slashdot

Filed Under: PLSQL - Date Manipulation

Tags:

RSSComments (0)

Trackback URL

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.