ILE COBOL Programmer's Guide

LC_TIME Category

In ILE COBOL the LC_TIME category is used to format date and time items that are based on a locale. Like other locale categories, LC_TIME consists of a series of keywords followed by their operands. The LC_TIME keyword "d_fmt" specifies the format of locale based date data items. The LC_TIME keyword "t_fmt" specifies the format of locale based time data items.

The following section gives a more detailed description of all the LC_TIME category keywords, including those not currently used by ILE COBOL. The descriptions below mention several conversion specifiers such as %a and %c that are currently not supported by ILE COBOL.

The LC_TIME category of a locale definition source file defines rules and symbols for formatting time and date information. This category begins with an LC_TIME category header and terminates with an END LC_TIME category trailer.

All operands for the LC_TIME category keywords are defined as string or integer values. String values are bounded by double quotation marks (""). All values are separated from the keyword they define by one or more spaces. Two adjacent double quotation marks indicate an undefined string value. A -1 indicates an undefined integer value. Field descriptors are used by commands and subroutines that query the LC_TIME category to represent elements of time and date formats. The following keywords are recognized in the LC_TIME category:

abday
Defines the abbreviated weekday names corresponding to the %a field descriptor. Recognized values consist of seven semicolon-separated strings. The first string corresponds to the abbreviated name for the first day of the week (Sun), the second to the abbreviated name for the second day of the week, and so on.

day
Defines the full spelling of the weekday names corresponding to the %A field descriptor. Recognized values consist of seven semicolon-separated strings. The first string corresponds to the full spelling of the name of the first day of the week (Sunday), the second to the name of the second day of the week, and so on. This keyword is not used by ILE COBOL.

abmon
Defines the abbreviated month names corresponding to the %b field descriptor. Recognized values consist of 12 semicolon-separated strings. The first string corresponds to the abbreviated name for the first month of the year (Jan), the second to the abbreviated name for the second month of the year, and so on. This keyword is not used by ILE COBOL.

mon
Defines the full spelling of the month names corresponding to the %B field descriptor. Recognized values consist of 12 semicolon-separated strings. The first string corresponds to the full spelling of the name for the first month of the year (January), the second to the full spelling of the name for the second month of the year, and so on. This keyword is not used by ILE COBOL.

d_t_fmt
Defines the string used for the standard date and time format corresponding to the %c field descriptor. The string can contain any combination of characters, field descriptors, or escape sequences. This keyword is not used by ILE COBOL.

d_fmt
Defines the string used for the standard date format corresponding to the %x field descriptor. The string can contain any combination of characters, field descriptors, or escape sequences. Following is an example of how the d_fmt keyword can be constructed:

%D
The %D indicates a %m/%d/%y date format.

%d-%m-%y

%m/%d/%Y

t_fmt
Defines the string used for the standard time format corresponding to the %X field descriptor. The string can contain any combination of characters, field descriptors, or escape sequences. Following is an example of how the t_fmt keyword can be constructed:

%H:%M:%S

%H.%M.%S

am_pm
Defines the strings used to represent ante meridian (before noon) and post meridian (after noon) corresponding to the %p field descriptor. Recognized values consist of two strings separated by a ; (semicolon). The first string corresponds to the ante meridian designation, the last string to the post meridian designation.

t_fmt_ampm
Defines the string used for the standard 12-hour time format that includes an am_pm value (%p field descriptor). This statement corresponds to the %r field descriptor. The string can contain any combination of characters and field descriptors. This keyword is not used by ILE COBOL.

era
Defines how the years are counted and displayed for each era in a locale, corresponding to the %E field descriptor modifier. For each era, there must be one string in the following format:
direction:offset:start_date:end_date:era_name:era_format

This keyword is not used by ILE COBOL.

The variables for the era-string format are defined as follows:

direction
Specifies a - (minus sign) or + (plus sign) character. The plus character indicates that years count in the positive direction when moving from the start date to the end date. The minus character indicates that years count in the negative direction when moving from the start date to the end date.

offset
Specifies a number representing the first year of the era.

start_date
Specifies the starting date of the era in the yyyy/mm/dd format, where yyyy, mm, and dd are the year, month, and day, respectively. Years prior to the year AD 1 are represented as negative numbers. For example, an era beginning March 5th in the year 100 BC would be represented as -100/03/05.

end_date
Specifies the ending date of the era in the same form used for the start_date variable or one of the two special values -* or +*. A -* value indicates that the ending date of the era extends backward to the beginning of time. A +* value indicates that the ending date of the era extends forward to the end of time. Therefore, the ending date can be chronologically before or after the starting date of the era. For example, the strings for the Christian eras AD and BC would be entered as follows:
+:0:0000/01/01:+*:AD:%o %N
+:1:-0001/12/31:-*:BC:%o %N

era_name
Specifies a string representing the name of the era that is substituted for the %EC field descriptor.

era_format
Specifies a string for formatting the %EY field descriptor.

An era value consists of one string for each era. If more than one era was specified, each era string is separated by a ; (semicolon).

era_d_fmt
Defines the string used to represent the date in alternate-era format corresponding to the %Ex field descriptor. The string can contain any combination of characters and field descriptors.

era_t_fmt
Defines the string used to represent the time in alternate-era format corresponding to the %EX field descriptor. The string can contain any combination of characters and field descriptors.

era_d_t_fmt
Defines the string used to represent the date and time in alternate-era format corresponding to the %Ec field descriptor. The string can contain any combination of characters and field descriptors.

alt_digits
Defines alternate strings for digits corresponding to the %O field descriptor. Recognized values consist of a group of strings separated by ; (semicolons). The first string represents the alternate string for zero, the second string represents the alternate string for one, and so on. A maximum of 100 alternate strings can be specified.

Escape Sequences

The following are escape sequences allowed for the d_t_fmt, d_fmt, and t_fmt keyword values:

\\
Represents the backslash character.

\a
Represents the alert character.

\b
Represents the backspace character.

\f
Represents the form-feed character.

\n
Represents the newline character.

\r
Represents the carriage-return character.

\t
Represents the tab character.

\v
Represents the vertical-tab character.

LC_TIME Example

The following is an example of a LC_TIME category in a locale definition source file:

      LC_TIME
      #
      #Abbreviated weekday names (%a)
      abday   "<S><u><n>";"<M><o><n>";"<T><u><e>";"<W><e><d>";\
              "<T><h><u>";"<F><r><i>";"<S><a><t>"
      #
      #Full weekday names (%A)
      day     "<S><u><n><d><a><y>";"<M><o><n><d><a><y>";\
              "<T><u><e><s><d><a><y>";"<W><e><d><n><e><s><d><a><y>";\
              "<T><h><u><r><s><d><a><y>";"<F><r><i><d><a><y>";\
              "<S><a><t><u><r><d><a><y>"
      #
      #Abbreviated month names (%b)
      abmon   "<J><a><n>";"<F><e><b>";"<M><a><r>";"<A><p><r>";\
              "<M><a><y>";"<J><u><n>";"<J><u><l>";"<A><u><g>";\
              "<S><e><p>";"<O><c><t>";"<N><o><v>";"<D><e><c>"
      #
      #Full month names (%B)
      mon     "<J><a><n><u><a><r><y>";"<F><e><b><r><u><a><r><y>";\
              "<M><a><r><c><h>";"<A><p><r><i><l>";"<M><a><y>";\
              "<J><u><n><e>";"<J><u><l><y>";"<A><u><g><u><s><t>";\
              "<S><e><p><t><e><m><b><e><r>";"<O><c><t><o><b><e><r>";\
              "<N><o><v><e><m><b><e><r>";"<D><e><c><e><m><b><e><r>"
      #
      #Date and time format (%c)
      d_t_fmt "%a_%bf%d %H:%M:%S %Y"
      #
      #Date format (%x)
      d_fmt   "%m/%d/%y"
      #
      #Time format (%X)
      t_fmt   "%H:%M:%S"
      #
      #Equivalent of AM/PM (%p)
      am_pm   "<A><M>";"<P><M>"
      #
      #12-hour time format (%r)
      t_fmt_ampm   "%I:%M:%Sm%p"
      #
      era     "+:0:0000/01/01:+*:AD:%EC";\
              "+:1:-0001/12/31:-*:BC:%Ey";
      era_d_fmt  ""
      alt_digits    "<0><t><h>";"<1><s><t>";"<2><n><d>";"<3><r><d>";\
                    "<4><t><h>";"<5><t><h>";"<6><t><h>";"<7><t><h>";\
                    "<8><t><h>";"<9><t><h>";"<1><0><t><h>"
      #
      END LC_TIME


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]