Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
#include
// Import the ctime library using namespace std; int main () { // Create the datetime structure and use mktime to correct mistakes struct tm datetime; datetime.tm_year = 2022 - 1900; // Number of years since 1900 datetime.tm_mon = 0; // 0 is January datetime.tm_mday = 32; datetime.tm_hour = 0; datetime.tm_min = 0; datetime.tm_sec = 0; datetime.tm_isdst = -1; mktime(&datetime); cout << asctime(&datetime); return 0; }
Tue Feb 1 00:00:00 2022