c date格式
// // Created by gxf on 2020/2/8. // #include <time.h> #include <stdio.h> int main(int argc, char **argv) { time_t seconds; time(&seconds); printf("seconds:%d\n", seconds); struct tm *date = NULL; date = localtime(&seconds); char dateBuff[1024]; strftime(dateBuff, 1024, "%Y-%m-%d %H:%M:%S", date); printf("datebuff:%s\n", dateBuff); return 0; }
Please call me JiangYouDang!