如何将CTime 类型转换为CString
如何将CTime 类型转换为CString 问题点数:0、回复次数:10Top
1 楼dzqsuper(数风流人物-还看打倒日本猪的人(抵制日货))回复于 2003-12-01 08:49:46 得分 0
加入收藏夹Top
2 楼zfive5(醉马不肖)回复于 2003-12-01 08:54:00 得分 0
CTime::FormatSee Also
CTime Overview | Class Members | Hierarchy Chart | CTime::FormatGmt
Call this member function to create a formatted representation of the date/time value.
CString Format(
LPCTSTR pszFormat
) const;
CString Format(
UINT nFormatID
) const;
Parameters
pszFormat
A 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 function strftime for a list of formatting codes.
nFormatID
The ID of the string that identifies this format.
Return Value
A CString that contains the formatted time.
Remarks
If the status of this CTime object is null, the return value is an empty string.
Example
// Example for CTime::Format and CTime::FormatGmt
CTime t( 1999, 3, 19, 22, 15, 0 );
// 10:15 PM March 19, 1999
CString s = t.Format( "%A, %B %d, %Y" );
ASSERT( s == "Friday, March 19, 1999" );
Top
3 楼arvid_gs(west)回复于 2003-12-01 08:56:52 得分 0
CTime t( 1999, 3, 19, 22, 15, 0 );
// 10:15 PM March 19, 1999
CString s = t.Format( "%A, %B %d, %Y" );
ASSERT( s == "Friday, March 19, 1999" );Top
4 楼zhansg(阿土)回复于 2003-12-01 09:02:11 得分 0
CTime t;
CString s;
t = CTime::GetCurrentTime();
s = t.Format("%A, %B %d, %Y");
s = t.Format("%Y/%m/%d");
s = t.Format("%H:%M:%S");
//....Top
5 楼Rayanywhere()回复于 2003-12-01 09:05:31 得分 0
用一个字符串变量格式化不就行了Top
6 楼liken218(想走走不了!)回复于 2003-12-01 09:06:52 得分 0
如“2003-01-12 14:15:16"
CTime tm=CTime::GetCurrentTime();
CString str=tm.Format("%Y-%m-%d %H:%M:%S");Top
7 楼gflpower(燕赤侠)回复于 2003-12-01 09:22:28 得分 0
这是帮助中的内容,没有用这个问题已经解决了谢谢
Top
8 楼gflpower(燕赤侠)回复于 2003-12-01 09:23:04 得分 0
回得好
Top
9 楼gflpower(燕赤侠)回复于 2003-12-01 09:26:22 得分 0
谢谢各位兄台
Top
10 楼dzqsuper(数风流人物-还看打倒日本猪的人(抵制日货))回复于 2004-02-12 20:36:45 得分 0
那就得结贴呀Top




