Simple types / Date and time

#include <iostream>
using namespace std;

time_t now = time(0);
tm tm = *localtime(&now);
int year = tm.tm_year + 1900;
int month = tm.tm_mon + 1;
int day = tm.tm_mday;
int hour = tm.tm_hour;
int minute = tm.tm_min;
int second = tm.tm_sec;
int dayOfWeek = tm.tm_wday;


cout << "year is " << year << endl;
cout << "month is " << month << endl;
cout << "day is " << day << endl;
cout << "hour is " << hour << endl;
cout << "minute is " << minute << endl;
cout << "second is " << second << endl;
cout << "dayOfWeek is " << dayOfWeek;