我看了一些关于 COleDateTime用法的贴子,也看MSDN,不过还是没有解决问题,请大家帮忙.
m_brith.GetCurrentTime();//m_brith 为关联到一个日期控件的COleDateTime类型变量
strbrith=m_brith.Format("%Y-%m-%d %H:%M:%S");//在此处出错 

解决方案 »

  1.   

    COleDateTime ti;
    ti=ti.GetCurrentTime();//这样写,我调试的时候程序就停在这里不走了,为什么呢?
    CString str=ti.Format(_T("123%Y-%m-%d %H:%M:%S"));
    AfxMessageBox(str);
      

  2.   

    我一般这样用:COleDateTime   ti; 
    ti=COleDateTime::GetCurrentTime();//这样写,我调试的时候程序就停在这里不走了,为什么呢? 
    CString   str=ti.Format(_T("123%Y-%m-%d   %H:%M:%S")); 
    AfxMessageBox(str);
      

  3.   

    下面这样试试:strbrith.Format("%d-%d-%d",m_brith.GetYear(),m_brith.GetMonth(),m_brith.GetDay());
      

  4.   

    //不是补丁问题,用法错误
    COleDateTime ti;   
    ti=COleDateTime::GetCurrentTime();//这样写
    CString str=ti.Format(_T("123%Y-%m-%d %H:%M:%S"));   
    AfxMessageBox(str);
      

  5.   

    //不是补丁问题,用法错误 [C/C++ code]COleDateTime ti;   
    ti=COleDateTime::GetCurrentTime();//这句这样写就可以了,其他的不用改
    CString str=ti.Format("%Y-%m-%d %H:%M:%S"));   
    AfxMessageBox(str);[/code]
      

  6.   

    if (InvoiceDate.ParseDateTime("2010-12-23"))
    {
    CString strDate = InvoiceDate.Format("%Y%m%d");
    }