#include
#include
using namespace std;
int main(int argc,char *argv[])
{
char now[64];
time_t tt;
struct tm *ttime;
tt = atol(argv[1]);
//tt = 1212132599;
//time(&tt);
ttime = localtime(&tt);
strftime(now,64,"%Y-%m-%d %H:%M:%S",ttime);
cout << "the time is " << now << endl;
}
编译后执行:
./strtotime 1212132599
输出为:
the time is 2008-05-30 15:29:59
阅读(4712) | 评论(0) | 转发(0) |