本文介绍了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] =10Plz指导我是否我已正确使用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)
发布评论