|
Description
This shows the strftime
function . In this particular example
we are returning the day but there
are a number of other formats we can
display.
Code
#include <time.h>
#include <stdio.h>
int main()
{
struct tm *ptr;
time_t tm;
char str[60];
tm = time(NULL);
ptr = localtime(&tm);
strftime(str ,100 , "It is %A.\n",ptr);
printf(str);
return 0;
}
Information
Tested in Visual C++6
and LCC win32.
A list of format commands
can be found here
|