C语言获取当前系统时间

原文链接:https://blog.csdn.net/yuec1998/article/details/79883318

 

#include<stdio.h>
#include<time.h>

int main(){
time_t timep;
struct tm *p;
time(&timep);
p = gmtime(&timep);
printf("%d\\%d\\%d:", (1900 + p->tm_year), (1 + p->tm_mon), p->tm_mday);
printf("%d;%d;%d\n", p->tm_hour+8, p->tm_min, p->tm_sec);
return;



posted @ 2019-12-08 16:05  wangaolin  阅读(435)  评论(0编辑  收藏  举报