有一个Combo Box组合框里面有不同国家的地区如:北京,上海,悉尼,伦敦,华盛顿....等等(有很多城市),有一个编辑框Edit用来显示在选择组合框里的地区的当前时间:年,月,日,时,分,秒。
我知道获取系统的当前时间:CTime time = CTime::GetCurrentTime();但是不知道要如何转换成不同地区的时间。
我知道获取系统的当前时间:CTime time = CTime::GetCurrentTime();但是不知道要如何转换成不同地区的时间。
调试欢乐多
格林威治时间转换为北京时间
http://blog.vckbase.com/teacheryang/archive/2008/04/27/33438.html
GetSystemTime(&tzi.StandardDate);
GetTimeZoneInformation(&tzi);
CString strStandName = tzi.StandardName;
CString strDaylightName = tzi.DaylightName;
CString strInfo;
strInfo.Format(_T("%s:时区%d,%s:时差%d小时"),strStandName,tzi.Bias / -60,strDaylightName,tzi.DaylightBias / -60);
AfxMessageBox(strInfo);