獲取當前系統時間
ctime time = ctime::
getcurrenttime()
;//獲取系統日期
cstring date = time.
format(_t
("%y-%m-%d %h:%m:%s %w-%a"))
;//2006-10-13 17:23:47 41-friday
時間比較
如果當前時間大於指定的時間,函式返回false
bool pubfunc::
comparetime
(int nyear,
int nmonth,
int nday)
獲取程式執行時間cstring str;
long t1 =
gettickcount()
;//程式段開始前系統執行時間
long t2 =
gettickcount()
;//程式段結束後系統執行時間
str.
format(_t
("\ntime:%dms"
), t2 - t1)
;//前後之差即程式執行時間
acutprintf
(str)
;
MFC獲取系統時間
1.使用ctime類 cstring str 獲取系統時間 ctime tm tm ctime getcurrenttime str tm.format 現在時間是 y年 m月 d日 x messagebox str,null,mb ok 2 得到系統時間日期 使用getlocaltime syst...
MFC獲取系統時間
mfc中呼叫電腦系統時間函式,首先建立乙個對話方塊,新增乙個按鈕,為該按鈕新增如下函式 ctime t ctime getcurrenttime int nyear t.getyear int nmonth t.getmonth int nday t.getday int nhour t.getho...
mfc獲取系統時間
1.使用ctime類 cstring str 獲取系統時間 ctime tm tm ctime getcurrenttime str tm.format 現在時間是 y年 m月 d日 x messagebox str,null,mb ok 2 得到系統時間日期 使用getlocaltime syst...