因为用的是ATL,如果include <afxdisp.h>使用MFC中的COleDateTime类 ,编译时就报错,是不是ATL中就不能使用COleDateTime 呢。
如果可以用,怎样用?
如果不可以用,怎样得到当前日期时间,DATE类型的?

解决方案 »

  1.   

    COleDateTime timeNow;
    DATE curDate;
    HRESULT hr;
    //Get current Time.
    timeNow = COleDateTime::GetCurrentTime();

    curDate = timeNow.m_dt;
      

  2.   

    (DATE)GetcurrentTime()行吗?转换一下
      

  3.   

    DATE curDate;
    SYSTEMTIME  tLocalTime;
    GetLocalTime(&tLocalTime);
    SystemTimeToVariantTime(&tLocalTime,&curDate);
      

  4.   

    in ATL,i use this class:
    http://www.ourcode.net/vc/vckbase/english/code/cpp_mfc/ATLDateTime.shtml.htm