strftime
man page
예제
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(int argc, char *argv[])
{
char buffer[1024] = {0,};
time_t temp;
struct tm * timeptr;
temp = time(NULL);
timeptr = localtime(&temp);
strftime(buffer, sizeof(buffer), "%Y%m%d_%H%M%S", timeptr);
printf("date: %s\n", buffer);
return 0;
}
댓글 없음:
댓글 쓰기