我用的是DATA Time
但是我只能设置为1970年1月1日——2039年12月31日这个范围之内
其他时间就不能设置了。。
我从DATA Time控件上得到的值通过Format(%Y,%m,%d)转换以后就为空了。。不知道为什么请教高手
我需要将它转换为CString
但是我只能设置为1970年1月1日——2039年12月31日这个范围之内
其他时间就不能设置了。。
我从DATA Time控件上得到的值通过Format(%Y,%m,%d)转换以后就为空了。。不知道为什么请教高手
我需要将它转换为CString
now=now.GetCurrentTime();
//GetCurrentTime()取得时间与time(time_t*timer);和structtm*localtime(consttime_t*timer);所得时间相同只能到2037年
//而GetLocalTime(&sysTime);可到9999年
m_year=now.GetYear();//年
m_month=now.GetMonth();//月
m_day=now.GetDay();//日CStringcs;
cs.Format("%d年%d月%d日",m_year,m_month,m_day);
CTime time;
time = CTime::GetCurrentTime();
CString str1 = time.Format("%A, %B %d, %Y" ); //星期?,?月?日,?年
CString str2 = time.Format("%D, %H, %M, %S %%");
/*%D Total days in this CTime
%H Hours in the current day
%M Minutes in the current hour
%S Seconds in the current minute
%% Percent sign*/
int day = time.GetDay();
int month = time.GetMonth();
int year = time.GetYear();
CString str3;
str3.Format("Day=>%d Month=>%d year=>%d",day,month,year);
CString msg;
msg = str1 + "\n" + str2+"\n"+str3;
AfxMessageBox(msg);
不知道怎么样将其Format才能没有限制
怎么样将CTime格式的1900-01-01转换成为CString格式呢。。CTime格式好象不能存储1900-01-01这个时间,好象超出了存储范围.
SYSTEMTIME CurTime;
GetLocalTime(&CurTime);
sYear.Format("%d年",CurTime.wYear);
sMonth.Format("%d月",CurTime.wMonth);
sDay.Format("%d日",CurTime.wDay);
sTime = sYear+ sMonth + sDay;