DateDiff问题(VB .net 4.0)

编程入门 行业动态 更新时间:2024-10-25 06:23:10
本文介绍了DateDiff问题(VB 4.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨!!, 对于我的一个项目,我在计时器中使用DateDiff功能,如下所述: - NoOfValues = DateDiff(DateInterval.Second,StartTime,EndTime) StartTime,EndTime&执行周期的NoOfValues如下所述

Hi!!, For one of my project i'm using DateDiff function in a timer as mentioned below:- NoOfValues = DateDiff(DateInterval.Second, StartTime, EndTime) the values of StartTime, EndTime & NoOfValues for a cycle of execution are as mentioned below

Start Time= 11/18/2013 4:28:46 PM End Time= 11/18/2013 4:29:37 PM NoOfValues= 51 Start Time= 11/18/2013 4:29:38 PM End Time= 11/18/2013 4:29:49 PM NoOfValues= 10 Start Time= 11/18/2013 4:29:50 PM End Time= 11/18/2013 4:30:00 PM NoOfValues= 10

我无法理解

I'm not able to understand how the difference of

[11/18/2013 4:29:38 PM & 11/18/2013 4:29:49 PM] =10

Plz指导我是否我已正确使用DateDiff函数。

Plz guide me whether i've used DateDiff function correctly.

推荐答案

您可以使用TimeSpan处理DateTime值的计算: You could use a TimeSpan to handle calculations on your DateTime values: Dim myDate1 As DateTime = new DateTime(2013, 11, 18, 4, 29, 38); Dim myDate2 As DateTime = new DateTime(2013, 11, 18, 4, 29, 49); TimeSpan ts = myDate2 - myDate1; long elapsedInMilliseconds = ts.Elapsed; float valueInSeconds = (float)elapsedInMilliseconds / 1000f; int value = Math.Floor(valueInSeconds);

更多推荐

DateDiff问题(VB .net 4.0)

本文发布于:2023-11-12 04:40:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580527.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:VB   DateDiff   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!