TO_CHAR (Converting Dates to Character Strings) |
TO_CHAR(d [,fmt [,'nlsparams']]) |
Converts a date/time value into a character-based representation of that value.
Parameters
d
Specifies a date/time value (of type DATE).
fmt
Specifies a date format string made up of the elements shown in Table 5-4.
nlsparams
Specifies a string in the form NLS_DATE_LANGUAGE=langname, where langname represents a valid NLS language name. The NLS language name affects the spelling used for day and month names.
Examples
SQL> SELECT TO_CHAR(SYSDATE),TO_CHAR(SYSDATE,'dd-Mon-yyyy hh:mi:ss PM') 2 FROM dual; TO_CHAR(SYSDATE) TO_CHAR(SYSDATE,'DD-MON ----------------- ----------------------- 21-May-2000 17:40 21-May-2000 05:40:43 PM SQL> SELECT TO_CHAR(SYSDATE,'dd-Mon-yyyy','NLS_DATE_LANGUAGE=FRENCH') 2 FROM dual; TO_CHAR(SYS ----------- 21-Mai-2000
Get Oracle SQL: the Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.