运行 ❯
获取您
自己的
网站
×
变更朝向
变更主题,深色/浅色
进入 Spaces
#include <iostream> #include <ctime> // Import the ctime library using namespace std; int main () { struct tm datetime; time_t timestamp; datetime.tm_year = 2023 - 1900; // Number of years since 1900 datetime.tm_mon = 12 - 1; // Number of months since January datetime.tm_mday = 17; datetime.tm_hour = 12; datetime.tm_min = 30; datetime.tm_sec = 1; // Daylight Savings must be specified // -1 uses the computer's timezone setting datetime.tm_isdst = -1; timestamp = mktime(&datetime); cout << ctime(×tamp); return 0; }
星期日 2023年12月17日 12:30:01