I am a newbie of C and I need to do a program to get the current date
information only, without the time. I have my code here:
#include <stdio.h>
#include <time.h>
#include <string.h>
int main ()
{
time_t rawtime;
struct tm * timeinfo;
char* t;
rawtime = time (NULL);
timeinfo = localtime (&rawtime);
t = asctime(timeinf o);
printf(t);
return 0;
}
How to output only the year, month and day of t?
information only, without the time. I have my code here:
#include <stdio.h>
#include <time.h>
#include <string.h>
int main ()
{
time_t rawtime;
struct tm * timeinfo;
char* t;
rawtime = time (NULL);
timeinfo = localtime (&rawtime);
t = asctime(timeinf o);
printf(t);
return 0;
}
How to output only the year, month and day of t?
Comment