Database Reference
In-Depth Information
Table 9.3
Some of the Date Formatting Models
Date Format Models
What Is It?
- / , . ;
Permitted punctuation with date string representation.
YEAR
The year (2002 shows TWO THOUSAND TWO).
YYYY
4-digit year.
YYY, YY & Y
Last n digits of the year.
Q
Quarter of year, 1 to 4.
MM
Month, 01 to 12.
MONTH & MON
Month name and abbreviated month name.
WW
Week of year, 1 to 53.
W
Week of month, 1 to 5.
D
Week day, 1 to 7.
DAY & DY
Day name and abbreviated day name.
DD
Day of month, 1 to 31.
DDD
Day of year, 1 to 366.
HH & HH12
Hour of day, 1 to 12.
HH24
24-hour clock, 0 to 23.
MI
Minutes, 0 to 59.
SS
Seconds, 0 to 59.
AM & PM
AM or PM.
AD & BC
BC or AD.
J
Julian day or number of days since 01/01/4712 BC.
RM
Roman month, I to XII.
Here are some examples using datatype conversion functions. Figure
9.10 shows part of the results. The TO_CHAR function for dates allows
you to format the date in a huge variety of ways.
SELECT TO_CHAR(RECORDING_DATE,'Day, Month dd, YYYY')
"Spell the day"
, TO_CHAR(RECORDING_DATE,'MM/DD/YY') "American style"
Search WWH ::




Custom Search