Extended DATE-format strings
The DATE-format functions that support the extended-DATE format strings are rdefmtdate() and rfmtdate().
The following table shows the extended-format strings that these functions
support for use with GLS locales. These extended-format strings format
eras with two-digit year offsets.
Era year | Format | Era used |
---|---|---|
Full era year: full name of the base year (period) followed by a two-digit year offset. Same as GL_DATE display format of "%EC%02.2Ey" | eyy | The era that the client locale (which CLIENT_LOCALE indicates) defines |
Abbreviated era year: abbreviated name of the base year (period) followed by a two-digit year offset. Same as GL_DATE display format of "%Eg%02.2Ey" | gyy | The era that the client locale (which CLIENT_LOCALE indicates) defines |
The following table shows some extended-format strings for era-based
dates. These examples assume that the client locale is Japanese SJIS
(ja_jp.sjis).
Description | Example format | October 5, 1990 prints as: |
---|---|---|
Abbreviated era year | gyymmd gyy.mm.dd |
H021005 H02.10.05 |
Full era year | eyymmdd eyy-mm-dd eyyB1B2mmB1B2ddB1B2 |
A1A2021005 A1A202-10-05 A1A202B1B210B1B205B1B2 |
The following code
fragment contains a call to the rdefmtdate() library
function:
char fmt_str[100];
char in_str[100];
long jdate;
...
rdatestr("10/05/95", &jdate);
stcopy("gyy/mm/dd", fmt_str);
rdefmtdate(&jdate, fmt_str, in_str);
printf("Abbreviated Era Year: %s\n", in_str);
stcopy("eyymmdd", fmt_str);
rdefmtdate(&jdate, fmt_str, in_str);
printf("Full Era Year: %s\n", in_str);
When the CLIENT_LOCALE specifies the Japanese
SJIS (ja_jp.sjis) locale, the code fragment displays the following
output:
Abbreviated Era Year: H07/10/05
Full Era Year: H021005