Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>strftime</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
strftime

Usage

   #include <time.h>
   size_t strftime(char *s, size_t max, const char *format, const
   struct tm *timeptr);

   ANSI

Description

   The strftime function inserts characters into the array pointed to by s
   following instructions in the format string. The format should be a
   multibyte character sequence, beginning and ending in its initial shift
   state. The format string consists of zero or more conversion
   specifications as well as ordinary multibyte characters. A conversion
   specification consists of a % character followed by a character that
   determines the conversion to be applied. All ordinary multibyte
   characters (including the terminating null character) are copied
   unchanged into the array. However, no more than max characters are placed
   into the array. Each conversion specification is replaced by appropriate
   characters as described in the following list. The appropriate characters
   are determined by the program s locale and by the values contained in the
   structure pointed to by timeptr.

   %a               is replaced by the locale s abbreviated weekday name.

   %A               is replaced by the locale s full weekday name.

   %b               is replaced by the locale s abbreviated month name.

   %B               is replaced by the locale s full month name.


   %c               is replaced by the locales appropriate date and time
                    representation.

   %d               is replaced by the day of the month as a decimal number
                    (01-31).

   %H               is replaced by the hour (24-hour clock) as a decimal
                    number (00-23).

   %I               is replaced by the hour (12-hour clock) as a decimal
                    number (00-12).

   %J               is replaced by the day of the year as a decimal number
                    (001-366).

   %m               is replaced by the month as a decimal number (01-12).

   %M               is replaced by the minute as a decimal number (00-59).

   %P               is replaced by the locale s equivalent of either AM or PM


   %S               is replaced by the second as a decimal number (00-60).

   %U               is replaced by the week number of the year, with Sunday
                    taken as the first day of the week, as a decimal number
                    (00-53).

   %w               is replaced by the weekday as a decimal number
                    (0(Sunday)-6).

   %W               is replaced by the week number of the year, with Monday
                    taken as the first day of the week, as a decimal number
                    (00-53).

   %x               is replaced by the locale s appropriate date
                    representation.

   %X               is replaced by the locale s appropriate time
                    representation.


   %y               is replaced by the year (without century) as a decimal
                    number (00-99).

   %Y               is replaced by the year (with century) as a decimal
                    number.

   %Z               is replaced by the time zone name or by no characters if
                    no time zone is determinable.

   %%               is replaced by %

   The strftime function should not be used to copy between objects that
   overlap, it does not handle overlapping moves correctly.

Example 

   #include <stdio.h>
   #include <time.h>
   #include <stdlib.h>

   int main()
   {
       char buf[80];
       struct tm *tp;
       time_t newtime;

       time(&newtime);
       tp = localtime(&newtime);
       strftime(buf, sizeof(buf), "%A, %B %d", tp);
       puts(buf);
       return EXIT_SUCCESS;
   }

Return Value

   strftime returns the number of characters placed in the array pointed to
   by s, not including the terminating null character. If the total number
   of resulting characters, including the terminating null character is
   greater than max, zero is returned, and the contents of the array will be
   invalid.

See Also

   asctime, ctime, gmtime, localtime, mktime, time , ctime,
   gmtime, localtime, mktime, time

seealso: asctime ctime gmtime localtime mktime time ctime gmtime localtime mktime time



Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson