在coledatetime中没有正确的价值 [英] uncorrect value in coledatetime
问题描述
我在MFC与COleDateTime战斗了几天。我有正确值的CTime。纠正年,日,月,小时,分钟和秒。我尝试了几种方法将CTime转换为COleDateTime:
-1。我将
I''m fighting a few days with COleDateTime in MFC. I have CTime with correct values. Correct years, days, months, hours, minutes and seconds. I tried a few ways to convert CTime to COleDateTime:
-1.I put
CTime
数据添加到构造函数
COleDateTime
COleDateTime(int nYear,int nMonth,int nDay, int nHour, int nMin,int nSec )
;
-2。我将
;
-2. I formatted
CTime
格式化为
time.Format("%m/%d/%y %H:%M:%S")
;
并传递给
;
and passed to
ParseDateTime
COleDateTime
。
-3。我还尝试使用
.
-3. Also I tried to use
SetDateTime
COleDateTime
之后我得到错误的分钟值1-2分钟。或多或少。我以前从未见过它,我在互联网上找不到任何东西。每个人都说abot损失精确度,但这是一秒,而不是一分钟。请给我一些建议!谢谢
After that I''m getting incorrect values of minutes 1-2 min. more or less. I have never seen it before and I couldn''t find nothing in internet.Everybody says abot loss precision but this a second, not a minute. Please advice something for me! Thank you
推荐答案
为什么不使用构造函数
Why don''t you use constructor
COleDateTime(
const SYSTEMTIME& systimeSrc
)
和方法
and method
bool CTime::GetAsSystemTime(
SYSTEMTIME& st
)
这篇关于在coledatetime中没有正确的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!