#include <ctime>
int main() {
time_t t = time(0); // current time: http://cplusplus.com/reference/clibrary/ctime/time/
struct tm * now = localtime(&t); // http://cplusplus.com/reference/clibrary/ctime/localtime/
// struct tm: http://cplusplus.com/reference/clibrary/ctime/tm/
int day = now->tm_mday;
int month = now->tm_mon + 1;
int year = now->tm_year + 1900;
}
Links from above
time(0)
: current time:
http://cplusplus.com/reference/clibrary/ctime/time/localtime
:
http://cplusplus.com/reference/clibrary/ctime/localtime/struct tm
:
http://cplusplus.com/reference/clibrary/ctime/tm/
1
solved Save Current Date into 3 Ints – C++ [closed]