Appendix D. Date Formats

This appendix summarizes the date format elements that may be used in a variety of Oracle tools (e.g., SQL*Plus), in the built-in packages, and in format specifications within SQL statements.

Table D-1 lists all date format elements. Table D-2 contains examples illustrating the use of many of these elements.

Table D-1. Date format elements

Formatelement

Function

- / , . ; :

Punctuation to be included in the output.

‘text’

Quoted text to be reproduced in the output.

AD or A.D.

BC or B.C.

AD, A.D., BC, or B.C. indicator included with the date.

AM or A.M.

PM or P.M.

AM, A.M., PM, or P.M. printed, whichever applies.

CC

The century number. This will be 20 for years 1900 through 1999.

SCC

Same as CC, but negative for BC dates.

D

The number of the day of the week—1 through 7.

DAY

The full name of the day.

DD

The day of the month.

DDD

The day of the year.

DY

The abbreviated name of the day.

E

The abbreviated era name. Valid only for Japanese Imperial, ROC Official, and Thai Buddha calendars.

EE

The full era name. See E.

FF

The fractional seconds. Valid only for TIMESTAMP types.

FM

Suppresses extra blanks and zeros in the character string representation of a date. For example, use ‘FMMonth DD’ to get `July 4’ rather than `July 04’.

HH

The hour of the day on a 12-hour clock.

HH12

The hour of the day on a 12-hour clock.

HH24

The hour of the day on a 24-hour clock.

IW

The ISO week number, which can be from 1 to 53. See ...

Get Oracle in a Nutshell 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.