【在c++中怎么把ctime类型或COleDateTime类型转化为string类型啊】
文章插图
以下来自MSDNCTime::Format 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. RemarksCall 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::FormatGmtCTime t( 1999, 3, 19, 22, 15, 0 ); // 10:15PM March 19, 1999CString s = t.Format( "%A, %B %d, %Y" );//这里就是把CTime转换成CStringASSERT( s == "Friday, March 19, 1999" );
推荐阅读
- 在物理化学中vap是什么意思 在物理化学中vap是啥意思
- 魔兽世界中级急救在哪学
- 倍电共享充电宝加盟,教你如何避坑!
- 抖音支付优惠券如何使用?附详情
- 芦荟胶可以敷一晚上吗 答案在这里
- 魏国大梁在什么地方 魏国大梁的简介
- 中国影视信息网的历史是什么,意味着什么?
- 中国美术馆要逛多久
- 中国美术馆怎么坐地铁
- 前景最好的3个新型创业项目 现在创业前景好的有什么项目