Use localtime to convert the time_t to a struct tm. You can use strftime to print the desired data from that.
char buff[20];
time_t now = time(NULL);
strftime(buff, 20, "%Y-%m-%d %H:%M:%S", localtime(&now));
Use localtime to convert the time_t to a struct tm. You can use strftime to print the desired data from that.
char buff[20];
time_t now = time(NULL);
strftime(buff, 20, "%Y-%m-%d %H:%M:%S", localtime(&now));