需求: 如题.使用数据访问接口ADO.
环境: win32 console,不使用MFC.查了很多资料 都是在MFC上的 好像没有sdk的 然后查了msdn 还是不得要领偶得做法是
VariantToString(_variant_t &vtData, char* pBuf)
{
switch(vtData.vt)
{
case VT_DATE:
{
time_t tt = vtData.date; // time_t tt(vtData.date)
// struct tm *now = gmtime(&tt); //
/*wsprintf(pBuf, "%Y%m%d%H%M%S", now->tm_year, now->tm_mon, now->tm_mday,
now->tm_hour, now->tm_min, now->tm_sec);*/
// wsprintf(pBuf, "%s", ctime(&tt));
double dd = vtData.date;
time_t ltime;
time( <ime );
struct tm * now = localtime(&tt);
wsprintf(pBuf, "%Y%m%d%H%M%S", now->tm_year, now->tm_mon, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec);
}
}
却老也不对.
快一年没回VC版提问了 分也没赚到 水平也没提高 郁闷. 哈
环境: win32 console,不使用MFC.查了很多资料 都是在MFC上的 好像没有sdk的 然后查了msdn 还是不得要领偶得做法是
VariantToString(_variant_t &vtData, char* pBuf)
{
switch(vtData.vt)
{
case VT_DATE:
{
time_t tt = vtData.date; // time_t tt(vtData.date)
// struct tm *now = gmtime(&tt); //
/*wsprintf(pBuf, "%Y%m%d%H%M%S", now->tm_year, now->tm_mon, now->tm_mday,
now->tm_hour, now->tm_min, now->tm_sec);*/
// wsprintf(pBuf, "%s", ctime(&tt));
double dd = vtData.date;
time_t ltime;
time( <ime );
struct tm * now = localtime(&tt);
wsprintf(pBuf, "%Y%m%d%H%M%S", now->tm_year, now->tm_mon, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec);
}
}
却老也不对.
快一年没回VC版提问了 分也没赚到 水平也没提高 郁闷. 哈
VariantTimeToSystemTime(vtData, &systime);
CTime tm(systime);
VariantTimeToSystemTime(vtData, &systime);不过这样是可以得 感谢先