And just so that you are aware, Polox, in addition to the correct date mask that Anand offered, you can also specify date masks that produce the following results:
MM: The number of the month (1-12).
RM: The month specified as a Roman numeral.
MON: The three-letter abbreviation of the month.
MONTH: The month fully spelled out.
D: The number of the day in the week.
DD: The number of the day in the month.
DDD: The number of the day in the year.
DY: The three-letter abbreviation of the day.
DAY: The day fully spelled out.
Y: The last digit of the year.
I: The last digit of the year, based on ISO standards.
YY: The last two digits of the year.
IY: The last two digits of the year, based on ISO standards.
YYY: The last three digits of the year.
IYY: The last three digits of the year, based on ISO standards.
YYYY: The full four-digit year.
IYYY: The four-digit year, based on ISO standards.
SYYYY: The year in a signed format, BC values represented negative.
Y,YYY: The year with a comma in the second position.
SCC: or CC The century; S prefixes BC dates with a -.
RR: The last two digits of the year used for year 2000 issues. (Affects two-digit year INPUT only)
YEAR: The year spelled out.
SYEAR: The year spelled out; S prefixes BC dates with a -.
Q: The number of the quarter.
WW: The number of the week in the year.
W: The number of the week in the month.
IW: The week of the year, based on ISO standards (1-53).
J: The number of days since December 31, 4713 B.C.
HH: or H12 The hour of the day (1-12).
HH24: The hour of the day (1-24).
MI: The minutes of the hour.
SS: The seconds of the minute.
SSSSS: The seconds since midnight.
A.M.: A.M. or P.M. is displayed, depending on the time of day.
P.M.: A.M. or P.M. is displayed, depending on the time of day.
AM: AM or PM is displayed, depending on the time of day.
PM: AM or PM is displayed, depending on the time of day.
A.D.: B.C. or A.D. is displayed, depending on the date.
B.C.: (Same as A.D.)
AD: BC or AD is displayed, depending on the date.
BC: (Same as AD.)
fm: The prefix of MONTH or DAY to suppress padded spaces.
th: The suffix of the number format to cause th, st, or rd to be added to the end of the number.
sp: The suffix of a number to force the number to be spelled out.
spth: The suffix of a number to force it to be spelled out and given an ordinal suffix.
thsp: (Same as spth.)
Use of any of the above masks result in
upper-cased output
based upon the case of the first two letters of the mask. For example, "MONTH" results in "SEPTEMBER", "MoNTH" results in "September" (along with "Month"), and "moNTH" results in "september".
Here is an example of above format masks put to exotic use:
Code:
********************************************************************************
select to_char(sysdate,
'"Today is "fmDay, Month Ddspth, "in the" Yyyyspth "year" B.C.')
"Example" from dual;
Example
-------------------------------------------------------------------------------
Today is Tuesday, September Twenty-Seventh, in the Two Thousand Fifth year A.D.
Let us know if you have additional DATE-format questions.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[
Providing low-cost remote Database Admin services]
Click here to join
Utah Oracle Users Group on Tek-Tips if you use
Oracle in
Utah USA.