Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ NLstrtime(3) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

NLtmtime

printf, fprintf, sprintf, NLprintf, NLfprintf, NLsprintf, wsprintf

setlocale

environment

date



NLSTRTIME(3,L)              AIX Technical Reference              NLSTRTIME(3,L)



-------------------------------------------------------------------------------
NLstrtime



PURPOSE

Formats time and date.

LIBRARY

Standard C Library (libc.a)

SYNTAX

char *NLstrtime (str, len, format, tmdate)
char *str, *format;
int len;
struct tm *tmdate;

DESCRIPTION

The NLstrtime subroutine converts the internal time and date specification
tmdate that is generated by the localtime or gmtime clock structures of ctime
(see "ctime, localtime, gmtime, asctime, tzset") into a character string under
the direction of format.  The resulting string is similar to the result of
printf format, and is placed in the memory location addressed by str.  It has a
maximum length of len and terminates with a NULL.

Many conversion specifications are the same as those used by the date command.
The interpretation of some conversion specifications is affected by the values
of environment variables for international character support (see
"environment").

The format parameter is a character string containing two types of objects:
plain characters that are simply placed in the output string, and conversion
specifications that convert information from tmdate into readable form in the
output string.  Each conversion specification is a sequence of this form:

%[[-]width][.precision]type

  o A % (percent sign) introduces a conversion specification.

  o An optional decimal digit string specifies a minimum field width.  A
    converted value that has fewer characters than the field width is padded
    with spaces to the right.  If the decimal digit string is preceded by a
    minus sign, padding with spaces occurs to the left of the converted value.

    If no width is given, for numeric fields the appropriate default width is
    used with the field padded on the left with zeros as required.  For
    strings, the output field is made exactly wide enough to contain the
    string.



Processed November 7, 1990      NLSTRTIME(3,L)                                1





NLSTRTIME(3,L)              AIX Technical Reference              NLSTRTIME(3,L)




  o An optional precision value gives the maximum number of characters to be
    printed for the conversion specification.  The precision value is a decimal
    digit string preceded by a period.  If the value to be output is longer
    than the precision, it is truncated on the right.

  o The type of conversion is specified by one or two conversion characters.
    The characters and their meanings are:

    m   The month of the year is output as a number between 01 and 12.

    h   The short month is output as a string established by the corresponding
        entry in the current environment file or the C locale, if applicable
        (see "setlocale").

    lh  The long month is output as a string established by corresponding entry
        in the current environment file or the C locale if applicable (see
        "setlocale."

    d   The day of the month is output as a number between 01 and 31.

    j   The Julian day of the year is output as a number between 001 and 366.

    w   The day of the week is output as a number between 0 and 6.

    a   The short day of the week is output as a string according to the
        corresponding entry in the current environment file or the C locale, if
        applicable (see "setlocale").

    la  The long day of the week is output according to the corresponding entry
        in the current environment file or the C locale, if applicable (see
        "setlocale").

    y   The year is output as a number between 00 and 99.

    Y   The year is output as a number between 0000 and 9999.

    D   The date is output in the format specified by the corresponding entry
        in the current environment file or the C locale, if applicable (see
        "setlocale").

    lD  The long date is output in the format specified by the corresponding
        entry in the current environment file or the C locale, if applicable
        (see "setlocale").

    sD  The short date is output in the format specified by the corresponding
        entry in the current environment file or the C locale, if applicable
        (see "setlocale").

    H   The hour of the day is output as a number between 00 and 23.





Processed November 7, 1990      NLSTRTIME(3,L)                                2





NLSTRTIME(3,L)              AIX Technical Reference              NLSTRTIME(3,L)



    sH  The hour of the day is output as a number between 01 and 12.

    M   The minute is output as a number between 00 and 59.

    S   The second is output as a number between 00 and 59.

    p   The AM or PM indicator is output as a string specified by corresponding
        entry in the current environment file or the C locale, if applicable
        (see "setlocale").

    z   The (standard or daylight-saving) time zone name is output as a string
        from the corresponding entry in the current environment file or the C
        locale, if applicable (see "setlocale").

    r   The time is output in the format specified by the corresponding entry
        in the current environment file or the C locale, if applicable (see
        "setlocale").

    T   The time is output in the format specified by the corresponding entry
        in the current environment file or the C locale, if applicable (see
        "setlocale").

    sT  The time is output in the format specified by the corresponding entry
        in the current environment file or the C locale, if applicable (see
        "setlocale").

    n   Only a new-line character is output.

    t   Only a tab character is output.

    x   Nothing is output; this conversion specification is used only as a
        delimiter.

    %   The % (percent) character is output.

RELATED INFORMATION

In this book:  "NLtmtime,"  "printf, fprintf, sprintf, NLprintf, NLfprintf,
NLsprintf, wsprintf," "setlocale," and "environment."

The date command in AIX Operating System Commands Reference.

"Introduction to International Character Support" in Managing the AIX Operating
System.

AIX Guide to Multibyte Character Set (MBCS) Support.









Processed November 7, 1990      NLSTRTIME(3,L)                                3



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026