69,371
社区成员
发帖
与我相关
我的任务
分享
#include <cassert>
#include <iostream>
#include <stdio.h>
int main()
{
printf(__TIME__);
system("pause");
return 0;
}
char *currentTime()
{
time_t tmp; //#include <ctime>
time(&tmp);
return ctime(&tmp);
}
void currentTime1()
{
time_t currTime;
struct tm *tp;
char buf[256];
currTime = time(NULL);
tp = localtime(&currTime);
strftime(buf, 256, "%Y-%m-%d %H:%M", tp);
strftime(buf, 256, "%c", tp);
strftime(buf, 256, "%m/%d/%y %H:%M", tp);
cout<<buf<<endl;
}