CString szTime;
CTime time = CTime::GetCurrentTime();
szTime.Format("%2d:%02d", time.GetHour(), time.GetMinute());
<你的Edit>SetWindowText(szTime);

解决方案 »

  1.   

    GetSystemTime是格林威治时间。
    GetCurrentTime是当前时间
      

  2.   

    CString szTime;
    CTime time = CTime::GetCurrentTime();
    time.Format("%x");
    m_Edit.SetWindowText(time);
      

  3.   

    CTime curTime= CTime::GetCurrentTime();
    cout<<"current time is "<<curTime.Format("%A, %B %d, %Y")<<"\n";
        cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
    SYSTEMTIME pTime;
    ::GetSystemTime(&pTime);
    cout<<"current time is" << pTime.wMilliseconds<<" " << pTime.wMinute<<" " <<pTime.wHour<<
    " " << pTime.wDay << " " << pTime.wMonth << " " << pTime.wYear<<endl;TWO method can  get all current time!
      

  4.   

    CTime time=CTime::GetCurrentTime();
    m_TIME=time.Format("%A,%B/%d/%Y,%H:%M:%S");
    UpdateData(false);
    //上面的m_TIME是我定义的edit控件名称。
      

  5.   

    CTime time = CTime::GetCurrentTime();
      

  6.   

    其實仲有一個,就系用
    SYSTEMTIME time;
    自己用MSDN查一嚇就知啦
      

  7.   

    CTime Timer=CTime::GetCurrentTime();
    CString str=Timer.Format(" %Y-%m-%d  %H:%M:%S ");CSDN:
    CTime::Format 
    CString Format( LPCTSTR pFormat ) const;CString Format( UINT nFormatID ) const;Return ValueA CString that contains the formatted time.ParameterspFormatA formatting string similar to the printf formatting string. Formatting codes, preceded by a percent (%) sign, are replaced by the corresponding CTime component. Other characters in the formatting string are copied unchanged to the returned string. See the run-time functionstrftime for details. The value and meaning of the formatting codes for Format are listed below: %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 
    nFormatIDThe ID of the string that identifies this format. ResCall this member function to create a formatted representation of the date/time value. If the status of this CTime object is null, the return value is an empty string. If the status of CTime is invalid, the return value is an empty string.Example// example for CTime::Format and CTime::FormatGmt
    CTime t( 1999, 3, 19, 22, 15, 0 ); 
    // 10:15PM March 19, 1999
    CString s = t.Format( "%A, %B %d, %Y" );
    ASSERT( s == "Friday, March 19, 1999" );CTime Overview |  Class Members |  Hierarchy ChartSee Also   CTime::FormatGmt
      

  8.   

    这应该是个比较基本的问题。
    CTime time=CTime::GetCurrentTime();
    time.GetYear();
    time.GetMonth();
    time.GetDay();
    time.GetHour();
    time.GetSecond();
    time.GetMinute();
    以上返回的都是int类型的。
    然后你就知道如何使用了。
      

  9.   

    _strdate(buffer),_strtime(buffer)也可以呀,只不过样将字符串转换一下就可以了.