Try OpenEdge Now
skip to main content
Internationalizing Applications
OpenEdge Resources : OpenEdge SQL : Format specifiers allowed with the TO_CHAR and TO_DATE functions
 

Format specifiers allowed with the TO_CHAR and TO_DATE functions

The following table describes the format specifiers you can use with the SQL TO_CHAR() and TO_DATE() functions.
Table 33. Format specifiers used with TO_CHAR() and TO_DATE()
Format specifier
Description
Comment
$
A value with a leading dollar sign. For example: $999.
-
,
A value with a comma in a specified position, but not a thousands separator. For example: 1.000,00.
-
.
A value with a decimal point in a specified position. For example: 99.99.
-
0
A value displaying a leading or trailing zero. For example, 0999 or 9990.
-
9
A set number of significant digits to be displayed. Display leading space if positive, leading minus if negative. Leading zeros are blank, except for a zero value returning a zero for the integer part of the number. For example: 9999.
-
A.M.
Meridian indicator in the native language—with periods.
English only
AM
Meridian indicator in the native language—without periods.
English only
CC
The century as a two-digit number—computed as one greater than the first two digits of the four-digit year.
Considers 1900 to be in the 20th century, 2000 to be in the 21st century, and so on.
D
The day of the week as a one-digit number between 1 and 7.
-
D
A value with an NLS_NUMERIC_CHARACTER in the specified position. The default D character is a period (.), for example: 99D9.
-
day
The day of the week in the native language—first letter only in uppercase.
English only
Day
The day of the week in the native language—first letter only in uppercase.
English only
DAY
The day of the week in the native language—entire name in uppercase.
English only
DD
The day of the month as a two-digit number between 01 and 31.
-
DDD
The day of the year as a three-digit number between 001 and 365.
-
DY
The day of the week as a three-character string in the native language.
English only
G
A value with an NLS_NUMERIC_CHARACER in the specified position. The default G character is a comma (,), for example: 9G999.
-
HH
The hour of the day as a two-digit number between 01 and 12.
-
HH12
The hour of the day as a two-digit number between 01 and 12.
Synonym of HH
HH24
The hour of the day as a two-digit number between 00 and 23.
-
J
The Julian day.
-
L
A value with the local currency symbol NLS_CURRENCY in the specified position. The default L character is a dollar sign ($). For example: L999.
-
MI
The minute of the hour as a two-digit number between 0 and 59.
-
MM
The month as a two-digit number between 01 and 12.
-
MON
The first three characters of the name of the month in the native language.
English only
MONTH
The first nine characters of the name of the month in the native language, right-padded with blanks.
English only
P.M.
Meridian indicator in the native language—with periods.
English only
PM
Meridian indicator in the native language—without periods.
English only
Q
The quarter of the year as a single digit between 1 and 4.
-
SCC
The century as a two-digit number—computed as one greater than the first two digits of the four-digit year. BC dates are prefixed by "-".
Considers 1900 to be in the 20th century, 2000 to be in the 21st century, and so on.
SS
Seconds as a two-digit number between 00 and 59.
-
SSSS
Seconds past midnight as a number between 0 and 86339.
-
TH
Ordinal suffix appended to a number—replaced by ST, ND, RD, or TH, depending on the last digit of the number.
English only
W
The week of the month as a single digit between 1 and 5.
-
WW
The week of the year as a two-digit number between 01 and 52.
-
Y
The year as a single digit.
-
Y,YYY
The year as a four-digit number—comma separates the first digit from the other digits.
-
YY
The year as a two-digit number.
-
YYY
The year as a three-digit number.
-
YYYY
The year as a four-digit number.
-