VS2019输出系统当前时间

#include <time.h>

void TimeDisp(void)
{
    time_t nowTime;
    nowTime = time(NULL);
    struct tm* sysTime = localtime(&nowTime);
    nowTime = time(NULL);
    sysTime = localtime(&nowTime);
    printf("系统时间:%d年%d月%d日%d时%d分%d秒\n", sysTime->tm_year + 1900, \
        sysTime->tm_mon + 1, sysTime->tm_mday, sysTime->tm_hour, sysTime->tm_min, sysTime->tm_sec);
}

 

上一篇:docker打包nginx


下一篇:Java(十)时间使用与时间新特性