Create local time from time()
#include <time.h>
#include <stdio.h>
int main(void)
{
struct tm *ptr;
time_t lt;
char str[80];
lt = time(NULL);
ptr = localtime(<);
strftime(str, 100, "It is now %H %p.", ptr);
printf(str);
return 0;
}
Related examples in the same category