首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

获取系统时间解决方案

2012-01-20 
获取系统时间请问怎样在MFC中获取系统的当前时间,如:2007-3-221:10:32[解决办法]CTime类 [解决办法]CTime

获取系统时间
请问怎样在MFC中获取系统的当前时间,如:   2007-3-2   21:10:32

[解决办法]
CTime类

[解决办法]
CTime t = CTime::GetCurrentTime();
然后即可调用各个成员:
GetDay
Returns the day represent by the CTime object.

GetDayOfWeek
Returns the day of the week represented by the CTime object.

GetHour
Returns the hour represented by the CTime object.

GetMinute
Returns the minute represented by the CTime object.

GetMonth
Returns the month represented by the CTime object.

GetSecond
Returns the second represented by the CTime object.

GetTime
Returns a __time64_t value for the given CTime object.

GetYear
Returns the year represented by the CTime object.

热点排行