/*************************************************************************
> File Name: time.cpp
> Author: chenhui
> Mail: *********
> Created Time: 2016年03月10日 11:20:58
************************************************************************/
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
time_t now_time;
char buf[128] = {0};
tm * local;
now_time=time(NULL);
cout<<now_time<<endl;
cout<<now_time-100<<endl;
local = localtime(&now_time);
strftime(buf, 128,"%Y-%m-%d %H:%M:%S", local);
cout<<"time format:"<<buf<<endl;
return 0;
}
> File Name: time.cpp
> Author: chenhui
> Mail: *********
> Created Time: 2016年03月10日 11:20:58
************************************************************************/
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
time_t now_time;
char buf[128] = {0};
tm * local;
now_time=time(NULL);
cout<<now_time<<endl;
cout<<now_time-100<<endl;
local = localtime(&now_time);
strftime(buf, 128,"%Y-%m-%d %H:%M:%S", local);
cout<<"time format:"<<buf<<endl;
return 0;
}