COleDateTime::SetDateTime

int SetDateTime( int nYear, int nMonth, int nDay, int nHour, int nMin, intnSec );

返回值:
如果成功设置该COleDateTime对象的值,则返回0;否则返回1。该返回值基于DateTimeStatus枚举类型。要了解更多的信息,请参阅SetStatus成员函数。

参数:
nYear, nMonth, nDay, nHour, nMin, nSec指示复制到该COleDateTime对象的日期和时间部分。

说明:
调用该函数设置该COleDateTime对象的日期和时间。
请参阅下面关于参数值有效边界的表:
参数边界
nYear100-9999
nMonth1-12
nDay1-31
nHour0-23
nMin0-59
nSec0-59
nDay值的确切上限随“年”和“月”的不同而不同。月份为1, 3, 5, 7, 8,10和12时, nDay值的确切上限为31;月份为4, 6, 9和11时,则为30;月份为2,它为28或29(闰年)。
如果参数指定的值不是有效的,该对象的状态设置为无效而对象的值不变。
下面是时间值的一些例子:
nHournMinnSec
13301:03:03
2345023:45:00
25300无效
9600无效
下面是日期值的一些例子:
nYearnMonthnDay
19954151995年4月15日
17897141789年7月17日
1925230无效
1000011无效
仅设置日期,请参阅COleDateTime::SetDate;仅设置时间,请参阅COleDateTime:: SetTime。
有关查看该COleDateTime对象值的其它成员函数,请参阅以下成员函数:
·GetDay
·GetMonth
·GetYear
·GetHour
·GetMinute
·GetSecond
·GetDayOfWeek
·GetDayOfYear
有关COleDateTime值的边界问题,请参阅联机文档《Visual C++程序员指南》中的“日期和时间:自动支持”。

请参阅:
COleDateTime::COleDateTime, COleDateTime::SetDate, COleDateTime::SetTime, COleDateTime::operator =, COleDateTime::GetStatus, COleDateTime::m_dt