⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_51770.htm

📁 vc
💻 HTM
字号:
<p>
序号:51770 发表者:navyly 发表日期:2003-09-04 09:32:35
<br>主题:向各位请教在SystemTimeToVariant中double是如何处理日期的?
<br>内容:在系统中,我们可以用doubl表示日期;但对两个double日期,我们如何计算它们的时间间隔(分别用日、时、分、秒表示)。<BR><BR>如:double dbl_Old,dbl_Cur;<BR>SYSTEMTIME sys_Time;<BR><BR>GetSystemTime(&amp;sys_Time);<BR>SystemTime(&amp;sys_Time, &amp;dbl_Old);<BR>…………<BR>…………<BR>(其他复杂操作后)<BR>GetSystemTime(&amp;sys_Time);<BR>SystemTime(&amp;sys_Time, &amp;dbl_Cur);<BR><BR>(如何计算两个日期的差值)?<BR><BR>在线等待,为盼!<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:微笑的撒旦 回复日期:2003-09-05 01:22:12
<br>内容:两数之差,整数是日期,小数*24是小时;小数*24*60是分钟;<BR>比如:<BR>2003/09/04 16:09:32<BR>转换成double就是:<BR>37868.673287037040<BR>2003/09/05 06:07:54<BR>就是:<BR>37869.255486111113<BR>差为:<BR>0.58219907407328719&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 日期为0<BR>0.58219907407328719*24 = 13.972777777758893&nbsp;&nbsp; 13小时<BR>0.972777777758893*60 = 58.366666665533579&nbsp;&nbsp;&nbsp;&nbsp; 58分<BR>0.366666665533579*60 = 21.999999932014742&nbsp;&nbsp;&nbsp;&nbsp; 22秒<BR><BR>看到这个问题,研究了一下。有不对请指出来噢!<BR>这是MSDN上的一段解释<BR>A variant time is stored as an 8-byte real value (double), representing a date between January 1, 100 and December 31, 9999, inclusive. The value 2.0 represents January 1, 1900; 3.0 represents January 2, 1900, and so on. Adding 1 to the value increments the date by a day. The fractional part of the value represents the time of day. Therefore, 2.5 represents noon on January 1, 1900; 3.25 represents 6:00 A.M. on January 2, 1900, and so on. Negative numbers represent dates prior to December 30, 1899.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -