CTime time = CTime::GetCurrentTime(); ///构造CTime对象 int m_nYear = time.GetYear(); ///年 int m_nMonth = time.GetMonth(); ///月 int m_nDay = time.GetDay(); ///日 int m_nHour = time.GetHour(); ///小时 int m_nMinute = time.GetMinute(); ///分钟 int m_nSecond = time.GetSecond(); ///秒
SYSTEMTIME ti; GetSystemTime(&ti); ////我们可以通过读取SYSTEMTIME结构体成员直接得到时间 typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds; } SYSTEMTIME, *PSYSTEMTIME;
文章评论(0条评论)
登录后参与讨论