#include <stdio.h> #include <time.h> time_t timer; // 時間の格納元 struct tm *ts; // time structure // 日本時間(localtime)に変換 time(&timer); ts = localtime(&timer); //年月日、時刻を表示 printf("%d/%d/%d %02d:%02d::%02d \n", ts->tm_year+1900, ts->tm_mon+1, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec);