阅读:3704回复:5
请问怎么将CTime::GetCurrentTime()获得的时间变量格式化成字符串?
我在程序中用CTime::GetCurrentTime()获得了系统时间,但在用Format()将它格式化成字符串时,系统总是说要一个long参数,而不接受我的格式化成字符串。我怎么才能把这个时间转换成字符串呢?
|
|
沙发#
发布于:2003-09-19 12:50
CTime::Format函数
|
|
板凳#
发布于:2003-09-19 15:17
但CTime中没有Format这个成员函数啊!只有COleDateTime中有此函数,但它只接受系统默认的格式化参数,而不接受我指定的参数。
|
|
地板#
发布于:2003-10-02 19:31
CTime t = CTime::GetCurrentTime();
char szTime[50]; int nYear =t.GetYear(); int nMonth =t.GetMonth(); int nDay = t.GetDay(); int nHour = t.GetHour(); int nMinute = t.GetMinute(); wsprintf(szTime, \"%i%02i%02i\", nYear, nMonth,nDay); 或者t.format(\"%D\")..... |
|
地下室#
发布于:2003-10-02 19:35
%a
Abbreviated weekday name %A Full weekday name %b Abbreviated month name %B Full month name %c Date and time representation appropriate for locale %d Day of month as decimal number (01 |
|
5楼#
发布于:2003-10-08 15:28
谢谢,给分! :)
|
|