zoukankan      html  css  js  c++  java
  • ADO读写DateTime方式

    // 读取日期
    var	= m_pResultSet->GetCollect(_variant_t("Birth_Time"));
    	
    DATE			dt		= var.date;
    COleDateTime	da		= COleDateTime(dt);
    CString			strData	= da.Format(_T("%Y-%m-%d"));
    m_GridList.SetItemText(m_nRow, m_nColumn, strData);
    
    
    // 写入日期
    COleDateTime	oleDate = COleDateTime::GetCurrentTime();
    CString			strDate = oleDate.Format(_T("%Y-%m-%d %H:%M:%S"));
    
    m_pBorrowRS->Fields->GetItem(_variant_t("Borrow_Date"))->PutValue(_variant_t(strDate));	
    m_GridList.SetItemText(m_nRow, m_nColumn, strDate);
    
    或:
    COleDateTime	oleDate = COleDateTime::GetCurrentTime();
    
    _variant_t	vtDate;
    vtDate.vt	= VT_DATE;
    vtDate		= oleDate.Format(_T("%Y-%m-%d %H:%M:%S"));
    
    m_pBorrowRS->Fields->GetItem(_variant_t("Borrow_Date"))->PutValue(vtDate);
    m_GridList.SetItemText(m_nRow, 3, (LPCTSTR)_bstr_t(vtDate));
    

     COleDateTime::GetCurrentTime()        var.date                

                                        \                     /                 

                                          \                 /                  

                                             \            /                   

                                    COleDateTime  oleDate;                                            

                                            /              \                  

                                          /                  \                

                                        /                      \   

                  var = oleDate.Format(...)     strDate = oleDate.Format(...)

  • 相关阅读:
    UVA 10391 STL容器的使用
    UVA 10763
    UVA 10935
    UVA 洪水
    UVA 1594 set 里面放queue
    关于STL 容器的嵌套使用, 小试牛刀
    丑数 UVA 136
    UVA 1368 DNA
    antd 上传文件控件使用方法(坑)
    mysql查询一条工单时间需要10秒。优化sql语句得以解决。
  • 原文地址:https://www.cnblogs.com/sura/p/2501183.html
Copyright © 2011-2022 走看看