标签:
Show_Current_Time:
1 #include <time.h> 2 #include <stdio.h> 3 4 int main(void) 5 { 6 char* weekday[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; 7 time_t Now = time(NULL); 8 struct tm* Tvar = localtime(&Now); 9 printf("Current time is : %4i-%02i-%02i[%s] %02i:%02i:%02i\n", Tvar->tm_year + 1900, Tvar->tm_mon + 1, Tvar->tm_mday, weekday[Tvar->tm_wday], Tvar->tm_hour, Tvar->tm_min, Tvar->tm_sec); 10 return 0; 11 }
tiger@animal ~/cc $ ./time_Now Current time is : 2016-10-15[Saturday] 13:08:55
标签:
原文地址:http://www.cnblogs.com/hadex/p/5964229.html