SilverScreen Solid Modeler



Previous topic Next topic  


Previous topic Next topic JavaScript is required for the print function  



size_t strftime(char *s, size_t n, char *fmt, struct tm *tp)


char      *s;           /* character buffer to receive formatted time string */

size_t     n;           /* maximum count of characters to store */

char      *fmt;         /* format string */

struct tm *tp;          /* address of time structure */




#include "time.h"


The strftime function formats the time represented by the struct tm pointer tp into the character buffer pointed to by s , under control of the format string fmt . No more than n characters are stored in s , including the null-terminator.




s is a character buffer that is to receive the formatted time string. n is an integer specifying the maximum number of characters to be stored into s . tp is the address of a struct tm containing a time representation. fmt is a null-terminated string containing ordinary characters and conversion specifications. Ordinary characters are copied unmodified into s ; conversion specifiers are replaced as described below.


A conversion specification is a '%' character followed by a conversion character. The conversion specifications are the following:





abbreviated weekday name, e.g., "Thu"


full weekday name, e.g., "Thursday"


abbreviated month name, e.g. "Jan"


full month name, e.g., "January"


local date and time representation


day of month, e.g., "01", "31"


hour (24 hour clock), e.g., "00", "23"


hour (12 hour clock), e.g., "01", "12"


day of the year, e.g., "001", "366"


month, e.g., "01", "12"


minute, e.g., "00", "59"


local equivalent of AM or PM


second, e.g., "00", "59"


week number of the year (from 1st Sunday), e.g., "00", "53"


week day (Sunday is 0), e.g., "00", "06"


week number of the year (from 1st Monday), e.g., "00", "53"


local date representation


local time representation


year (no century), e.g., "00", "99"


year (with century), e.g., "1995"


time zone name, if known


a single %



Return Value

strftime returns the number of characters stored in s , if less than n ; otherwise, if the string would be larger than n , strftime returns 0.



See Also

strdate , strtime