包括年月日时分秒!

解决方案 »

  1.   

    应该用 GetLocalTime() 函数
      

  2.   

    CTime tim;
    tim=CTime::GetCurrentTime();
    CString str; nYear=tim.GetYear();
    nMonth=tim.GetMonth();
    nDay=tim.GetDay();
    nHour=tim.GetHour();
    nMinute=tim.GetMinute();
    nSecond=tim.GetSecond();

    str.Format("%d:%d:%d",nHour,nMinute,nSecond);
    m_edtDesignTime.SetWindowText(str); str.Format("%d-%d-%d",nYear,nMonth,nDay);
    m_edtDesignDate.SetWindowText(str);看看我这个吧
    其中m_edt等变量是与对话框中的CEdit 控件关联的弯量
      

  3.   

    SYSTEMTIME SystemTime; 
    GetSystemTime(&SystemTime);

    WORD year, month, day; 
    year=SystemTime.wYear;
    month=SystemTime.wMonth;
    day=SystemTime.wDay;