#include <iostream>
#include <string.h>
#include <cstdio>
using namespace std;
time_t string_to_time_t(string s)
{
int yy, mm, dd, hour, min, sec;
struct tm when;
long tme;
memset(&when, 0, sizeof(struct tm));
sscanf(s.c_str(), "%d/%d/%d:%d:%d:%d", &dd, &mm, &yy, &hour, &min, &sec);
time(&tme);
when = *localtime(&tme);
when.tm_year = yy-1900;
when.tm_mon = mm-1;
when.tm_mday = dd;
when.tm_hour = hour;
when.tm_min = min;
when.tm_sec = sec;
return mktime(&when);
}
string time_t_to_string(time_t t)
{
char buff[20];
strftime(buff, 20, "%d/%m/%Y:%H:%M:%S", localtime(&t));
string s(buff);
return s;
}
int main()
{
string s = "30/11/2012:13:49:55";
time_t t = string_to_time_t(s);
string ss = time_t_to_string(t);
cout << ss << "\n";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxjc3RkaW8+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0aW1lX3Qgc3RyaW5nX3RvX3RpbWVfdChzdHJpbmcgcykKewogICAgaW50IHl5LCBtbSwgZGQsIGhvdXIsIG1pbiwgc2VjOwogICAgc3RydWN0IHRtIHdoZW47CiAgICBsb25nIHRtZTsKCiAgICBtZW1zZXQoJndoZW4sIDAsIHNpemVvZihzdHJ1Y3QgdG0pKTsKICAgIHNzY2FuZihzLmNfc3RyKCksICIlZC8lZC8lZDolZDolZDolZCIsICZkZCwgJm1tLCAmeXksICZob3VyLCAmbWluLCAmc2VjKTsKCiAgICB0aW1lKCZ0bWUpOwogICAgd2hlbiA9ICpsb2NhbHRpbWUoJnRtZSk7CiAgICB3aGVuLnRtX3llYXIgPSB5eS0xOTAwOwogICAgd2hlbi50bV9tb24gPSBtbS0xOwogICAgd2hlbi50bV9tZGF5ID0gZGQ7CiAgICB3aGVuLnRtX2hvdXIgPSBob3VyOwogICAgd2hlbi50bV9taW4gPSBtaW47CiAgICB3aGVuLnRtX3NlYyA9IHN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