#include <string>
#include <time.h>
using namespace std
;
string
getTime()
{
time_t timep
;
time
(&timep
);
char tmp
[64];
strftime(tmp
, sizeof(tmp
), "%Y-%m-%d %H:%M:%S",localtime(&timep
) );
return tmp
;
}
int main(){
string time
= getTime();
cout
<< time
<< endl
;
return 0;
}
转载请注明原文地址:https://tech.qufami.com/read-19376.html