可以用CTime的成员函数Format生成m_strFilter
解决方案 »
- unresolved external symbol "long __stdcall WindowProc(struct HWND__ *,unsigned i
- 网络聊天室程序运行时总是出现“绑定失败”而且还有一个警告
- 大文件传输方案,求建议
- 给个将文件制作成iso光盘镜像的源码吧
- 纠结,最近老是喜欢泡在CSDN了
- 请问如何用最简单的方法建立个sock的连接
- 如何让滑动块slider控件支持WM_LBUTTONUP并能使用对话框中的变量啊!
- 一道高中数学题
- 按回车退出问题
- 有空帮我用VC、VB做个软件,我付费!!!
- 如何动态的,监视别人的屏幕?用Hook吗?Hook的原理?
- 请教:字符串变量,怎样才能转化为整型变量?
还想请教:如何与数据库中的datetime类型的数据(日期一列)进行比较?
CString str = time.Format("%Y-%M-%D %h:%m:%s");
还可以在Format(str)指定日期地格式。详情参见MSDN。
CString m_strFilter=time.Format();
不过呢,你最好看看msdn!!
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 date;
CRecord * m_set;(CRecord 中有对应数据库表中列的变量m_date,表中列定义为Datetime类型;//赋值
m_set->m_date=date;
UpdateData(TRUE);结果数据库表中得到的列date的值不仅有年、月、日,还有时、分、秒,如何只取其中的年、月、日,赋值给数据库中的date列呢?