Document revision date: 19 July 1999
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

DEC C Run-Time Library Utilities Reference Manual


Previous Contents Index

2.7.2 Field Descriptors

The LC_TIME locale definition source file uses field descriptors to represent elements of time and date formats. You can combine these field descriptors to create other field descriptors or to create time and date format strings. When used in format strings that contain field descriptors and other characters, field descriptors are replaced by their current values. All other characters are copied without change. Table 2-8 lists the field descriptors used by commands and subroutines that query the LC_TIME category for time formatting.

Table 2-8 LC_TIME Locale Field Descriptors
Field Descriptor Meaning
%a Represents the abbreviated weekday name (for example, Sun) defined by the abday statement.
%A Represents the full weekday name (for example, Sunday) defined by the day statement.
%b Represents the abbreviated month name (for example, Jan) defined by the abmon statement.
%B Represents the full month name (for example, January) defined by the mon statement.
%c Represents the date-and-time format defined by the d_t_fmt statement.
%C Represents the century as a decimal number (00 to 99).
%d Represents the day of the month as a decimal number (01 to 31).
%D Represents the date in %m/%d/%y format (for example, 01/31/91).
%e Represents the day of the month as a decimal number (1 to 31).

If the day of the month is not a 2-digit number, the leading digit is filled with a space character.

%Ec Specifies the alternate date-and-time representation for the locale.
%EC Specifies the name of the base year (period) in the locale's alternate representation.
%Ex Specifies the alternate date representation for the locale.
%Ey Specifies the offset from %EC (year only) in the locale's alternate representation.
%EY Specifies the full alternate year representation.
%h Represents the abbreviated month name (for example, Jan) defined by the abmon statement. This field descriptor is a synonym for the %b field descriptor.
%H Represents the 24-hour clock hour as a decimal number (00 to 23).
%I Represents the 12-hour clock hour as a decimal number (01 to 12).
%j Represents the day of the year as a decimal number (001 to 366).
%m Represents the month of the year as a decimal number (01 to 12).
%M Represents the minutes of the hour as a decimal number (00 to 59).
%n Specifies a new-line character.
%Od Specifies the day of the month by using the locale's alternate numeric symbols.
%Oe Specifies the day of the month by using the locale's alternate numeric symbols.
%OH Specifies the hour (24-hour clock) by using the locale's alternate numeric symbols.
%OI Specifies the hour (12-hour clock) by using the locale's alternate numeric symbols.
%Om Specifies the month by using the locale's alternate numeric symbols.
%OM Specifies the minutes by using the locale's alternate numeric symbols.
%OS Specifies the seconds by using the locale's alternate numeric symbols.
%OU Specifies the week number of the year (with Sunday as the first day of the week) by using the locale's alternate numeric symbols.
%Ow Specifies the weekday as a number in the locale's alternate representation (Sunday = 0).
%OW Specifies the week number of the year (with Monday as the first day of the week) by using the locale's alternate numeric symbols.
%Oy Specifies the year (offset from %C) using the locale's alternate numeric symbols.
%p Represents the a.m. or p.m. string defined by the am_pm statement.
%r Represents the 12-hour clock time with a.m./p.m. notation as defined by the t_fmt_ampm statement.
%S Represents the seconds of the minute as a decimal number (00 to 59).
%t Specifies a tab character.
%T Represents 24-hour clock time in the format %H:%M:%S (for example, 16:55:15).
%U Represents the week of the year as a decimal number (00 to 53).

Sunday, or its equivalent as defined by the day statement, is considered the first day of the week for calculating the value of this field descriptor.

%w Represents the day of the week as a decimal number (0 to 6).

Sunday, or its equivalent as defined by the day statement, is considered to be 0 (zero) for calculating the value of this field descriptor.

%W Represents the week of the year as a decimal number (00 to 53).

Monday, or its equivalent as defined by the day statement, is considered the first day of the week for calculating the value of this field descriptor.

%x Represents the date format defined by the d_fmt statement.
%X Represents the time format defined by the t_fmt statement.
%y Represents the year of the century (00 to 99).
%Y Represents the year as a decimal number (for example, 1989).
%% Specifies a % (percent sign) character.

2.7.3 Sample Locale Definition

The following is a sample LC_TIME category specified 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) 
#Note that for improved readability, this section uses actual 
#characters, rather than symbolic names, and is inconsistent with 
#the other sections in this example.  This is bad form. 
#In practice, symbolic names should be used. 
d_t_fmt         "%a %b %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) 
#Note that for improved readability, this section uses actual 
#characters, rather than symbolic names, and is inconsistent with 
#the other sections in this example.  This is bad form. 
#In practice, symbolic names should be used. 
t_fmt_ampm      "%I:%M:%S %p" 
# 
era             "+:0:0000/01/01:+*:AD:%Ey %EC";\
"+:1:-0001/12/31:-*:BC:%Ey %EC" 
 
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 


Chapter 3
Character Set Description (Charmap) File

The character set description file, called the charmap file, defines character symbols as character encodings. This file is the source file for a coded character set, or codeset.

3.1 Portable Character Set

All supported codesets have the Portable Character Set (PCS) as a proper subset. The PCS consists of the character symbols (listed by their standardized symbolic names) and their hexadecimal encodings, as shown in Table 3-1.

Table 3-1 Portable Character Set
Symbol Name Hexadecimal Encoding
<NUL> \x00
<alert> \x07
<backspace> \x08
<tab> \x09
<newline> \x0A
<vertical-tab> \x0B
<form-feed> \x0C
<carriage-return> \x0D
<space> \x20
<exclamation-mark> \x21
<quotation-mark> \x22
<number-sign> \x23
<dollar-sign> \x24
<percent> \x25
<ampersand> \x26
<apostrophe> \x27
<left-parenthesis> \x28
<right-parenthesis> \x29
<asterisk> \x2A
<plus-sign> \x2B
<comma> \x2C
<hyphen> \x2D
<period> \x2E
<slash> \x2F
<zero> \x30
<one> \x31
<two> \x32
<three> \x33
<four> \x34
<five> \x35
<six> \x36
<seven> \x37
<eight> \x38
<nine> \x39
<colon> \x3A
<semi-colon> \x3B
<less-than> \x3C
<equal-sign> \x3D
<greater-than> \x3E
<question-mark> \x3F
<commercial-at> \x40
<A> \x41
<B> \x42
<C> \x43
<D> \x44
<E> \x45
<F> \x46
<G> \x47
<H> \x48
<I> \x49
<J> \x4A
<K> \x4B
<L> \x4C
<M> \x4D
<N> \x4E
<O> \x4F
<P> \x50
<Q> \x51
<R> \x52
<S> \x53
<T> \x54
<U> \x55
<V> \x56
<W> \x57
<X> \x58
<Y> \x59
<Z> \x5A
<left-bracket> \x5B
<backslash> \x5C
<right-bracket> \x5D
<circumflex> \x5E
<underscore> \x5F
<grave-accent> \x60
<a> \x61
<b> \x62
<c> \x63
<d> \x64
<e> \x65
<f> \x66
<g> \x67
<h> \x68
<i> \x69
<j> \x6A
<k> \x6B
<l> \x6C
<m> \x6D
<n> \x6E
<o> \x6F
<p> \x70
<q> \x71
<r> \x72
<s> \x73
<t> \x74
<u> \x75
<v> \x76
<w> \x77
<x> \x78
<y> \x79
<z> \x7A
<left-brace> \x7B
<vertical-line> \x7C
<right-brace> \x7D
<tilde> \x7E

3.2 Components of a Charmap File

A charmap file has the following components:

The following is a portion of a sample charmap file:


CHARMAP 
<code_set_name>         "ISO8859-1" 
<mb_cur_max>            1 
<mb_cur_min>            1 
<escape_char>           \
<comment_char>          # 
 
<NUL>                   \x00 
<SOH>                   \x01 
<STX>                   \x02 
<ETX>                   \x03 
<EOT>                   \x04 
<ENQ>                   \x05 
<ACK>                   \x06 
<alert>                 \x07 
<backspace>             \x08 
<tab>                   \x09 
<newline>               \x0a 
<vertical-tab>          \x0b 
<form-feed>             \x0c 
<carriage-return>       \x0d 
END CHARMAP 


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
6494PRO_003.HTML