#include <iostream>
#include <ctime>
using namespace std;
int main() {
// your code goes here
time_t previous_time = 1470104004; // input previous time by hand
// convert time_t to structure tm. You can use instead gmtime() for UTC
tm *tm_previous = localtime(&previous_time);
// print time using asctime() function.
cout << asctime(tm_previous);
// for current time
time_t current_time = time(0); // get current time
tm *tm_current = localtime(¤t_time);
cout << asctime(tm_current);
// print by accessing contents of the structure
cout << tm_current->tm_year + 1900 // year 0 corresponds to 1900
<< "/" << tm_current->tm_mon+1 // month starts from 0
<< "/" << tm_current->tm_mday // mday means day in a month
<< " " << tm_current->tm_hour
<< ":" << tm_current->tm_min
<< ":" << tm_current->tm_sec <<endl;
// get unixtime from YY-mm-dd
tm *jan2014 = localtime(¤t_time);
jan2014->tm_year = 2014 - 1900;
jan2014->tm_mon = 1 - 1;
jan2014->tm_mday = 1;
jan2014->tm_hour = 0;
jan2014->tm_min = 0;
jan2014->tm_sec = 0;
// print unix time
cout << mktime(jan2014) << endl;
// print datime
cout << asctime(jan2014) << endl;
return 0;
}