急望大牛能指点一二 关于c++中时间的有关问题
急~~望大牛能指点一二 关于c++中时间的问题
客户给我一串数组 191 144 239 121 22 19 64 228 这是十进制的 它表示 2012-08-15 14:57:05
客户说这是double型的 在计算机中的时候 这些数组应该转为16进制的 即 bf 90 ef 79 16 13 40 e4
现在的问题怎样将这组数变为时间2012-08-15 14:57:05
解不出来也没关系 交流知识也行
------解决方案--------------------
COleDateTimeSpan::COleDateTimeSpan
COleDateTimeSpan( );
COleDateTimeSpan( const COleDateTimeSpan& dateSpanSrc );
COleDateTimeSpan( double dblSpanSrc );
COleDateTimeSpan( long lDays, int nHours, int nMins, int nSecs );
Parameters
dateSpanSrc
An existing COleDateTimeSpan object to be copied into the new COleDateTimeSpan object.
dblSpanSrc
The number of days to be copied into the new COleDateTimeSpan object.
lDays, nHours, nMins, nSecs
Indicate the day and time values to be copied into the new COleDateTimeSpan object.
Remarks
All of these constructors create new COleDateTimeSpan objects initialized to the specified value. A brief description of each of these constructors follows:
COleDateTimeSpan( ) Constructs a COleDateTimeSpan object initialized to 0.
COleDateTimeSpan( dateSpanSrc ) Constructs a COleDateTimeSpan object from an existing COleDateTimeSpan object.
COleDateTimeSpan( dblSpanSrc ) Constructs a COleDateTimeSpan object from a floating-point value.
COleDateTimeSpan( lDays, nHours, nMins, nSecs ) Constructs a COleDateTimeSpan object initialized to the specified numerical values.
The status of the new COleDateTimeSpan object is set to valid.
For more information about the bounds for COleDateTimeSpan values, see the articleDate and Time: Automation Support in Visual C++ Programmer’s Guide.
Example
COleDateTimeSpan spanOne( 2.75 ); // 2 days and 18 hours
COleDateTimeSpan spanTwo( 2, 18, 0, 0 ); // 2 days and 18 hours
COleDateTimeSpan spanThree( 3, -6, 0, 0 ); // 2 days and 18 hours
COleDateTimeSpan Overview | Class Members | Hierarchy Chart
See Also COleDateTimeSpan::operator =, COleDateTimeSpan::GetStatus, COleDateTimeSpan::m_span, COleDateTimeSpan::m_status
------解决方案--------------------
逆向算一遍:
COleDateTime oletime(2012,8,15,14,57,05);
double dt = test.m_dt;
我这边算出来的dt是41136.622974537036,转成十六进制是0x40e41613ef684bda,跟你说的有几个字节是相同的。。。但我真想不出来他们的数值是怎么来的。。。
客户给我一串数组 191 144 239 121 22 19 64 228 这是十进制的 它表示 2012-08-15 14:57:05
客户说这是double型的 在计算机中的时候 这些数组应该转为16进制的 即 bf 90 ef 79 16 13 40 e4
现在的问题怎样将这组数变为时间2012-08-15 14:57:05
解不出来也没关系 交流知识也行
------解决方案--------------------
COleDateTimeSpan::COleDateTimeSpan
COleDateTimeSpan( );
COleDateTimeSpan( const COleDateTimeSpan& dateSpanSrc );
COleDateTimeSpan( double dblSpanSrc );
COleDateTimeSpan( long lDays, int nHours, int nMins, int nSecs );
Parameters
dateSpanSrc
An existing COleDateTimeSpan object to be copied into the new COleDateTimeSpan object.
dblSpanSrc
The number of days to be copied into the new COleDateTimeSpan object.
lDays, nHours, nMins, nSecs
Indicate the day and time values to be copied into the new COleDateTimeSpan object.
Remarks
All of these constructors create new COleDateTimeSpan objects initialized to the specified value. A brief description of each of these constructors follows:
COleDateTimeSpan( ) Constructs a COleDateTimeSpan object initialized to 0.
COleDateTimeSpan( dateSpanSrc ) Constructs a COleDateTimeSpan object from an existing COleDateTimeSpan object.
COleDateTimeSpan( dblSpanSrc ) Constructs a COleDateTimeSpan object from a floating-point value.
COleDateTimeSpan( lDays, nHours, nMins, nSecs ) Constructs a COleDateTimeSpan object initialized to the specified numerical values.
The status of the new COleDateTimeSpan object is set to valid.
For more information about the bounds for COleDateTimeSpan values, see the articleDate and Time: Automation Support in Visual C++ Programmer’s Guide.
Example
COleDateTimeSpan spanOne( 2.75 ); // 2 days and 18 hours
COleDateTimeSpan spanTwo( 2, 18, 0, 0 ); // 2 days and 18 hours
COleDateTimeSpan spanThree( 3, -6, 0, 0 ); // 2 days and 18 hours
COleDateTimeSpan Overview | Class Members | Hierarchy Chart
See Also COleDateTimeSpan::operator =, COleDateTimeSpan::GetStatus, COleDateTimeSpan::m_span, COleDateTimeSpan::m_status
------解决方案--------------------
逆向算一遍:
COleDateTime oletime(2012,8,15,14,57,05);
double dt = test.m_dt;
我这边算出来的dt是41136.622974537036,转成十六进制是0x40e41613ef684bda,跟你说的有几个字节是相同的。。。但我真想不出来他们的数值是怎么来的。。。