"Fossies" - the Fresh Open Source Software Archive

Member "newstrftime.3.txt" (25 Nov 2022, 6620 Bytes) of package /linux/misc/tzcode2022g.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 NEWSTRFTIME(3)             Library Functions Manual             NEWSTRFTIME(3)
    2 
    3 NAME
    4        strftime - format date and time
    5 
    6 SYNOPSIS
    7        #include <time.h>
    8 
    9        size_t strftime(char *restrict buf, size_t maxsize,
   10            char const *restrict format, struct tm const *restrict timeptr);
   11 
   12        cc ... -ltz
   13 
   14 DESCRIPTION
   15        The strftime function formats the information from timeptr into the
   16        array pointed to by buf according to the string pointed to by format.
   17 
   18        The format string consists of zero or more conversion specifications
   19        and ordinary characters.  All ordinary characters are copied directly
   20        into the array.  A conversion specification consists of a percent sign
   21        and one other character.
   22 
   23        No more than maxsize bytes are placed into the array.
   24 
   25        Each conversion specification is replaced by the characters as follows
   26        which are then copied into the array.
   27 
   28        %A     is replaced by the locale's full weekday name.
   29 
   30        %a     is replaced by the locale's abbreviated weekday name.
   31 
   32        %B     is replaced by the locale's full month name.
   33 
   34        %b or %h
   35               is replaced by the locale's abbreviated month name.
   36 
   37        %C     is replaced by the century (a year divided by 100 and truncated
   38               to an integer) as a decimal number [00,99].
   39 
   40        %c     is replaced by the locale's appropriate date and time
   41               representation.
   42 
   43        %D     is equivalent to %m/%d/%y.
   44 
   45        %d     is replaced by the day of the month as a decimal number [01,31].
   46 
   47        %e     is replaced by the day of month as a decimal number [1,31];
   48               single digits are preceded by a blank.
   49 
   50        %F     is equivalent to %Y-%m-%d (the ISO 8601 date format).
   51 
   52        %G     is replaced by the ISO 8601 year with century as a decimal
   53               number.  See also the %V conversion specification.
   54 
   55        %g     is replaced by the ISO 8601 year without century as a decimal
   56               number [00,99].  This is the year that includes the greater part
   57               of the week.  (Monday as the first day of a week).  See also the
   58               %V conversion specification.
   59 
   60        %H     is replaced by the hour (24-hour clock) as a decimal number
   61               [00,23].
   62 
   63        %I     is replaced by the hour (12-hour clock) as a decimal number
   64               [01,12].
   65 
   66        %j     is replaced by the day of the year as a decimal number
   67               [001,366].
   68 
   69        %k     is replaced by the hour (24-hour clock) as a decimal number
   70               [0,23]; single digits are preceded by a blank.
   71 
   72        %l     is replaced by the hour (12-hour clock) as a decimal number
   73               [1,12]; single digits are preceded by a blank.
   74 
   75        %M     is replaced by the minute as a decimal number [00,59].
   76 
   77        %m     is replaced by the month as a decimal number [01,12].
   78 
   79        %n     is replaced by a newline.
   80 
   81        %p     is replaced by the locale's equivalent of either "AM" or "PM".
   82 
   83        %R     is replaced by the time in the format %H:%M.
   84 
   85        %r     is replaced by the locale's representation of 12-hour clock time
   86               using AM/PM notation.
   87 
   88        %S     is replaced by the second as a decimal number [00,60].  The
   89               range of seconds is [00,60] instead of [00,59] to allow for the
   90               periodic occurrence of leap seconds.
   91 
   92        %s     is replaced by the number of seconds since the Epoch (see
   93               ctime(3)).
   94 
   95        %T     is replaced by the time in the format %H:%M:%S.
   96 
   97        %t     is replaced by a tab.
   98 
   99        %U     is replaced by the week number of the year (Sunday as the first
  100               day of the week) as a decimal number [00,53].
  101 
  102        %u     is replaced by the weekday (Monday as the first day of the week)
  103               as a decimal number [1,7].
  104 
  105        %V     is replaced by the week number of the year (Monday as the first
  106               day of the week) as a decimal number [01,53].  If the week
  107               containing January 1 has four or more days in the new year, then
  108               it is week 1; otherwise it is week 53 of the previous year, and
  109               the next week is week 1.  The year is given by the %G conversion
  110               specification.
  111 
  112        %W     is replaced by the week number of the year (Monday as the first
  113               day of the week) as a decimal number [00,53].
  114 
  115        %w     is replaced by the weekday (Sunday as the first day of the week)
  116               as a decimal number [0,6].
  117 
  118        %X     is replaced by the locale's appropriate time representation.
  119 
  120        %x     is replaced by the locale's appropriate date representation.
  121 
  122        %Y     is replaced by the year with century as a decimal number.
  123 
  124        %y     is replaced by the year without century as a decimal number
  125               [00,99].
  126 
  127        %Z     is replaced by the time zone abbreviation, or by the empty
  128               string if this is not determinable.
  129 
  130        %z     is replaced by the offset from the Prime Meridian in the format
  131               +HHMM or -HHMM (ISO 8601) as appropriate, with positive values
  132               representing locations east of Greenwich, or by the empty string
  133               if this is not determinable.  The numeric time zone abbreviation
  134               -0000 is used when the time is Universal Time but local time is
  135               indeterminate; by convention this is used for locations while
  136               uninhabited, and corresponds to a zero offset when the time zone
  137               abbreviation begins with "-".
  138 
  139        %%     is replaced by a single %.
  140 
  141        %+     is replaced by the locale's date and time in date(1) format.
  142 
  143 RETURN VALUE
  144        If the conversion is successful, strftime returns the number of bytes
  145        placed into the array, not counting the terminating NUL; errno is
  146        unchanged if the returned value is zero.  Otherwise, errno is set to
  147        indicate the error, zero is returned, and the array contents are
  148        unspecified.
  149 
  150 ERRORS
  151        This function fails if:
  152 
  153        [ERANGE]
  154               The total number of resulting bytes, including the terminating
  155               NUL character, is more than maxsize.
  156 
  157        This function may fail if:
  158 
  159        [EOVERFLOW]
  160               The format includes an %s conversion and the number of seconds
  161               since the Epoch cannot be represented in a time_t.
  162 
  163 SEE ALSO
  164        date(1), getenv(3), newctime(3), newtzset(3), time(2), tzfile(5)
  165 
  166 BUGS
  167        There is no conversion specification for the phase of the moon.
  168 
  169                                                                 NEWSTRFTIME(3)