//只显示小时
( (CDateTimeCtrl*)GetDlgItem(IDC_StartHour) )->SetFormat(_T("HH"));
获取控件的值:
CTime m_date;
( (CDateTimeCtrl*)GetDlgItem(IDC_StartDate) )->GetTime(m_date);
int year1 = m_date.GetYear();
int month1 = m_date.GetMonth();
int day1 = m_date.GetDay();
( (CDateTimeCtrl*)GetDlgItem(IDC_StartHour) )->GetTime(m_date);
int hour1 = m_date.GetHour();
然后可以按照规定的格式拼接字符串了。