#include "stdafx.h"
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
time_t now = time(NULL);
int sec = now % 60;
int min = ((now - sec) / 60) % 60;
int hour = ((((now - sec) / 60) - min) / 60) % 24;
int day = ((((((now - sec) / 60) - min) / 60) - hour) / 24) % 30;
int month = ((((((((now - sec) / 60) - min) / 60) - hour) / 24) - day) / 30) % 12;
int year = ((((((((((now - sec) / 60) - min) / 60) - hour) / 24) - day) / 30) - month) / 12) + 1970;
cout << hour << ":" << min << ":"<< ":" << day << ":" << month << ":" << year<<endl;
}
I can't understand why month output 10 instead of 3 ???
(I know there is c_time function but i am learning and making my own one)