#include <windows.h>
#include <iostream>
#include <string>
int main()
{
/*
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
*/
SYSTEMTIME Time;
GetLocalTime(&Time);
std::cout << Time.wYear << "年"
<< Time.wMonth << "月"
<< Time.wDay << "号"
<< Time.wHour << "点"
<< Time.wMinute << "分"
<< Time.wSecond << "秒"
<< Time.wMilliseconds << "毫秒"
<< std::endl;
std::string week[7] = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
std::cout << week[Time.wDayOfWeek] << std::endl;
system("pause");
return 0;
}
c/c++获取系统时间
最新推荐文章于 2024-09-11 22:09:09 发布