AD or BC: AD or BC as appropriate : Date Format « SQL Data Types « Oracle PL/SQL Tutorial






SQL>
SQL> SELECT TO_CHAR(SYSDATE, 'AD')
  2  FROM dual;

TO
--
AD

SQL>








10.7.Date Format
10.7.1.Insert Date value with default format
10.7.2.By default, the database outputs dates in the format DD-MON-YY
10.7.3.Datetime Formatting Parameters for TO_CHAR() function
10.7.4.SELECT TO_CHAR(ADD_MONTHS(TO_DATE('01-JAN-2005 19:15:26','DD-MON-YYYY HH24:MI:SS'), 2), 'DD-MON-YYYY HH24:MI:SS') FROM dual;
10.7.5.CC: Two-digit century
10.7.6.SCC: Two-digit century with a negative sign (-) for B.C.
10.7.7.Q: One-digit quarter of the year
10.7.8.YYYY: All four digits of the year
10.7.9.IYYY: All four digits of the ISO year
10.7.10.RRRR: All four digits of the rounded year, which depends on the current year
10.7.11.SYYYY: All four digits of the year with a negative sign (-) for B.C.
10.7.12.Y,YYY: All four digits of the year with a comma
10.7.13.YYY: Last three digits of the year
10.7.14.IYY: Last three digits of the ISO year
10.7.15.YY: Last two digits of the year
10.7.16.IY: Last two digits of the ISO year
10.7.17.RR: Last two digits of the rounded year, which depends on the current year
10.7.18.Y: Last digit of the year
10.7.19.I: Last digit of the ISO year
10.7.20.YEAR: Name of the year in uppercase
10.7.21.Year: Name of the year with the first letter in uppercase
10.7.22.MM: Two-digit month of the year
10.7.23.MONTH: Full name of the month in uppercase, right-padded with spaces to a total length of nine characters
10.7.24.Month: Full name of the month with first letter in uppercase, right-padded with spaces to a total length of nine characters
10.7.25.MON: First three letters of the name of the month in uppercase
10.7.26.Mon: First three letters of the name of the month with the first letter in uppercase
10.7.27.RM:Roman numeral month.
10.7.28.WW: Two-digit week of the year
10.7.29.IW: Two-digit ISO week of the year
10.7.30.W: One-digit week of the month
10.7.31.DDD: Three-digit day of the year
10.7.32.DD:Two-digit day of the month
10.7.33.D: One-digit day of the week
10.7.34.DAY: Full name of the day in uppercase
10.7.35.Day: Full name of the day with the first letter in uppercase
10.7.36.DY: First three letters of the name of the day in uppercase
10.7.37.Dy: First three letters of the name of the day with the first letter in uppercase
10.7.38.J: Julian day-the number of days that have passed since January 1, 4713 B.C.
10.7.39.HH24: Two-digit hour in 24-hour format
10.7.40.HH: Two-digit hour in 12-hour format
10.7.41.MI: Two-digit minute
10.7.42.SS: Two-digit second
10.7.43.-/,.;: 'text'
10.7.44.SELECT TO_CHAR(SYSDATE, 'DD/MM/YYYY')
10.7.45.AM or PM: AM or PM as appropriate
10.7.46.SELECT TO_CHAR(SYSDATE, 'PM')
10.7.47.A.M. or P.M.: A.M. or P.M. as appropriate (2)
10.7.48.SELECT TO_CHAR(SYSDATE, 'P.M.') (2)
10.7.49.AD or BC: AD or BC as appropriate
10.7.50.TO_CHAR(SYSDATE, 'BC')
10.7.51.A.D. or B.C.: A.D. or B.C. as appropriate (2)
10.7.52.TO_CHAR(SYSDATE, 'B.C.') (2)
10.7.53.DDSPTH 'of' MONTH, YEAR A.D.
10.7.54.DAY MON, YY AD
10.7.55.SELECT TO_CHAR(TO_DATE('05-FEB-1968'), 'MONTH DD, YYYY')