怎么样把时间转换成 int 型。。。 我从时间控件中读出的时间,怎么样才能转换成数值。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 什么数据?说清楚啊。比如2003年4月13日,你想变成什么样子的啊? 20030413这样的吗?那不可以,int没有这么大。 CTime::GetTime()返回time_t类型,time_t其实就是long 型 MFC Library Reference SYSTEMTIME Structure See AlsoStructures, Styles, Callbacks, and Message Maps | CTime::CTimeThe SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds;} SYSTEMTIME;ParameterswYear The current year. wMonth The current month; January is 1. wDayOfWeek The current day of the week; Sunday is 0, Monday is 1, and so on. wDay The current day of the month. wHour The current hour. wMinute The current minute. wSecond The current second. wMilliseconds The current millisecond. Example// Retrieves the current system date and time. The system // time is expressed in Coordinated Universal Time (UTC). SYSTEMTIME systime;GetSystemTime(&systime);// Determine day of the week.CString day;switch (systime.wDayOfWeek){case 0: day = "Sunday"; break;case 1: day = "Monday"; break;case 2: day = "Tuesday"; break;case 3: day = "Wednesday"; break;case 4: day = "Thursday"; break;case 5: day = "Friday"; break;case 6: day = "Saturday"; break;}// Show the time in a message box.char str[50];wsprintf(str, "%s %u/%u/%u %u:%u:%u:%u", day, systime.wYear, systime.wMonth, systime.wDay, systime.wHour, systime.wMinute, systime.wSecond, systime.wMilliseconds);AfxMessageBox(str);See AlsoStructures, Styles, Callbacks, and Message Maps | CTime::CTime--------------------------------------------------------------------------------Send feedback to Microsoft© 2001 Microsoft Corporation. All rights reserved. 但是,我用GetTime得到的怎么是 0 ??? CTime tt(year,month,....);//用时间控件中获取的值构造time_t t1 = tt.GetTime(); CTime::GetTime()得到的是自1970年1月1日0点到CTime记录的时间所经历的秒数。 什么时间类型CTime还是COledateTime先声明6个int类型变量day,month,year,hour,minute,second,逐个复值格式:COledateTime(d,m,y,h,m,s); COleDataTime好用。CTime不能小于1970年。COleDateTime可以大于0099年 mfc ado 连接 oracle 执行sql语句#3092 求解答 ----- 小问题但不知出在哪 vs2005中新建项目时找不到自己定制的平台SDK 急搜vc++编写的多媒体播放器 重载关闭按钮失败 各位,如何使combox显示初始值 完成端口完整服务端客户端源码(高手作品),但是有问题需要指点? 散分!100 问个菜问题 在线程中怎么实现精确定时? 为什么同样的程序,加到注册表的自启动中就不行了? 关于WinAPI 和 MFC。。 为什么一个字符指针无对它进行操作会变空?
比如2003年4月13日,你想变成什么样子的啊? 20030413这样的吗?那不可以,int没有这么大。
Structures, Styles, Callbacks, and Message Maps | CTime::CTime
The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
Parameters
wYear
The current year.
wMonth
The current month; January is 1.
wDayOfWeek
The current day of the week; Sunday is 0, Monday is 1, and so on.
wDay
The current day of the month.
wHour
The current hour.
wMinute
The current minute.
wSecond
The current second.
wMilliseconds
The current millisecond.
Example
// Retrieves the current system date and time. The system
// time is expressed in Coordinated Universal Time (UTC).
SYSTEMTIME systime;
GetSystemTime(&systime);// Determine day of the week.
CString day;
switch (systime.wDayOfWeek)
{
case 0:
day = "Sunday";
break;case 1:
day = "Monday";
break;case 2:
day = "Tuesday";
break;case 3:
day = "Wednesday";
break;case 4:
day = "Thursday";
break;case 5:
day = "Friday";
break;case 6:
day = "Saturday";
break;
}// Show the time in a message box.
char str[50];
wsprintf(str, "%s %u/%u/%u %u:%u:%u:%u",
day,
systime.wYear, systime.wMonth, systime.wDay,
systime.wHour, systime.wMinute, systime.wSecond, systime.wMilliseconds);
AfxMessageBox(str);
See Also
Structures, Styles, Callbacks, and Message Maps | CTime::CTime--------------------------------------------------------------------------------Send feedback to Microsoft© 2001 Microsoft Corporation. All rights reserved.
time_t t1 = tt.GetTime();
先声明6个int类型变量day,month,year,hour,minute,second,逐个复值
格式:COledateTime(d,m,y,h,m,s);
COleDateTime可以大于0099年