函数原型:
size_t strftime (char* ptr, size_t maxsize, const char* format,const struct tm* timeptr );
代码示例:
#include <stdio.h>
#include <time.h>
int main ()
{
time_t rawtime;
struct tm * timeinfo;
char buffer [128];
time (&rawtime);
timeinfo = localtime (&rawtime);
strftime (buffer,sizeof(buffer),"Now is %Y/%m/%d %H:%M:%S",timeinfo);
puts (buffer);
return 0;
}