首页 > 代码库 > 爱上C之:time
爱上C之:time
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
localtime(time_t *)
爱上C之:time
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。