Release 10.1A: OpenEdge Data Management:
SQL Reference

> ## Date formats

> A date-format string can contain any of the following format keywords along with other characters. The format keywords in the format string are replaced by corresponding values to get the result. The other characters are displayed as literals. Table 46 lists the date formats and their corresponding descriptions.

> Table 46: Date formats and descriptions
> Date format | Description
> --- | ---
> `CC` | The century as a two-digit number.
> `YYYY` | The year as a four-digit number.
> `YYY` | The last three digits of the year.
> `YY` | The last two digits of the year.
> `Y` | The last digit of the year.
> `Y,YYY` | The year as a four-digit number with a comma after the first digit.
> `Q` | The quarter of the year as a one-digit number (with values `1`, `2`, `3`, or `4`).
> `MM` | The month value as a two-digit number (in the range `01-12`).
> `MONTH` | The name of the month as a string of nine characters ('`JANUARY`' to '`DECEMBER`').
> `MON` | The first three characters of the name of the month (in the range'`JAN`' to '`DEC`').
> `WW` | The week of the year as a two-digit number (in the range`01-53`).
> `W` | The week of the month as a one-digit number (in the range `1-5`).
> `DDD` | The day of the year as a three-digit number (in the range `001-366`).
> `DD` | The day of the month as a two-digit number (in the range `01-31`).
> `D` | The day of the week as a one-digit number (in the range `1-7`, `1` for Sunday and `7` for Saturday).
> `DAY` | The day of the week as a character string of nine characters (in the range '`SUNDAY`' to '`SATURDAY`').
> `DY` | The day of the week as a character string of three characters (in the range '`SUN`' to '`SAT`').
> `J` | The Julian day (number of days since `DEC 31, 1899`) as an eight-digit number.
> `TH` | When added to a format keyword that results in a number, this format keyword ('`TH`') is replaced by the string '`ST`', '`ND`', '`RD`', or '`TH`' depending on the last digit of the number.

> Example

> The following example illustrates the use of the `DAY`, `MONTH`, `DD`, and `TH` format strings:

>     SELECT C1 FROM T2;

>     C1
>     --
>     09/29/1952

>     1 record selected

>     SELECT TO_CHAR (C1, 'Day, Month ddth'),
>        TO_CHAR (C2, 'HH12 a.m.') FROM T2;

>     TO_CHAR (C1,DAY, MONTH DDTH) TO_CHAR (C2,HH12 A.M.)
>     ---------------------------- ----------------------
>     Monday, September 29th 02 p.m.

>     1 record selected

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095