1 #include<stdio.h> 2 #include<time.h> 3 4 int main(int argc, char *argv[]) 5 { 6 time_t rawtime; 7 struct tm *info; 8 char buffer[80]; 9 time( &rawtime ); 10 info = localtime( &rawtime ); 11 strftime(buffer, 80, "%Y-%m-%d %H:%M:%S", info); 12 printf("日期 & 时间 : |%s|\n", buffer ); 13 14 return(0); 15 }
//时间:输出
//日期 & 时间 : |2021-08-06 08:05:07|