#include <time.h>
//* 方法一
time_t tt = time(NULL);//这句返回的只是一个时间cuo
tm* t= localtime(&tt);
printf("%d-%02d-%02d %02d:%02d:%02d ",
t->tm_year + 1900,
t->tm_mon + 1,
t->tm_mday,
t->tm_hour,
t->tm_min,
t->tm_sec);
//* 方法二
SYSTEMTIME st = {0};
GetLocalTime(&st);
printf("%d-%02d-%02d %02d:%02d:%02d ",
st.wYear,
st.wMonth,
st.wDay,
st.wHour,
st.wMinute,
st.wSecond);
下面几个,是网上找的:转载地址:http://apps.hi.baidu.com/share/detail/17815869
//* 方法一
time_t tt = time(NULL);//这句返回的只是一个时间cuo
tm* t= localtime(&tt);
printf("%d-%02d-%02d %02d:%02d:%02d ",
t->tm_year + 1900,
t->tm_mon + 1,
t->tm_mday,
t->tm_hour,
t->tm_min,
t->tm_sec);
//* 方法二
SYSTEMTIME st = {0};
GetLocalTime(&st);
printf("%d-%02d-%02d %02d:%02d:%02d ",
st.wYear,
st.wMonth,
st.wDay,
st.wHour,
st.wMinute,
st.wSecond);
下面几个,是网上找的:转载地址:http://apps.hi.baidu.com/share/detail/17815869