Prev: converting doubles to string
Next: Timer function
From: fniles on 14 Dec 2009 11:47 In a VB6 programs and VB.NET programs using "Imports VBDT = Microsoft.VisualBasic.DateAndTime", we use the function Timer like so: VB6 MyTime = Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & Right(Format(Timer, "#0.00"), 2) VB.NET Imports VBDT = Microsoft.VisualBasic.DateAndTime MyTime = Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & Right(VBDT.Timer.ToString("#0.00"), 2) An example of the result of MyTime: 38624.73 In the above example, does 73 mean 73 miliseconds ? But, 1 seconds has 1000 miliseconds, so that doesn't make sense. If the above function doesn't represent miliseond, what is the best way to get the milliseconds ? Thank you
From: CY on 14 Dec 2009 11:55 On 14 Dec, 17:47, "fniles" <fni...(a)pfmail.com> wrote: > In a VB6 programs and VB.NET programs using "Imports VBDT = > Microsoft.VisualBasic.DateAndTime", we use the function Timer like so: > VB6 > MyTime = Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & Right(Format(Timer, > "#0.00"), 2) > > VB.NET > Imports VBDT = Microsoft.VisualBasic.DateAndTime > MyTime = Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & > Right(VBDT.Timer.ToString("#0.00"), 2) > > An example of the result of MyTime: > 38624.73 > > In the above example, does 73 mean 73 miliseconds ? But, 1 seconds has 1000 > miliseconds, so that doesn't make sense. > > If the above function doesn't represent miliseond, what is the best way to > get the milliseconds ? > > Thank you Public Declare Function GetTickCount Lib "kernel32" () As Long is your friend... //CY
From: fniles on 14 Dec 2009 12:26 Thank you for your quick reply. But GetTickCount retrieves the number of milliseconds that have elapsed since the system was started. How can I get the milliseconds of that minute ? for ex: 11:24:01 and 93 milliseconds. Also, what does the Timer function that I use below returns in the last 2 digits ? An example of the result of MyTime: 38624.73 In the above example, does 73 mean 73 miliseconds ? .. "CY" <christery(a)gmail.com> wrote in message news:157f6ee0-b253-4400-be8b-71626e554c4b(a)d21g2000yqn.googlegroups.com... > On 14 Dec, 17:47, "fniles" <fni...(a)pfmail.com> wrote: >> In a VB6 programs and VB.NET programs using "Imports VBDT = >> Microsoft.VisualBasic.DateAndTime", we use the function Timer like so: >> VB6 >> MyTime = Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & Right(Format(Timer, >> "#0.00"), 2) >> >> VB.NET >> Imports VBDT = Microsoft.VisualBasic.DateAndTime >> MyTime = Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & >> Right(VBDT.Timer.ToString("#0.00"), 2) >> >> An example of the result of MyTime: >> 38624.73 >> >> In the above example, does 73 mean 73 miliseconds ? But, 1 seconds has >> 1000 >> miliseconds, so that doesn't make sense. >> >> If the above function doesn't represent miliseond, what is the best way >> to >> get the milliseconds ? >> >> Thank you > > Public Declare Function GetTickCount Lib "kernel32" () As Long > is your friend... > > //CY
From: Jeff Johnson on 14 Dec 2009 12:31 "fniles" <fniles(a)pfmail.com> wrote in message news:%23uAhw0NfKHA.3916(a)TK2MSFTNGP05.phx.gbl... > MyTime = Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & > Right(VBDT.Timer.ToString("#0.00"), 2) > > An example of the result of MyTime: > 38624.73 That's some SERIOUSLY broken code if the format string "dd-MMM-yyyy HH:nn:ss" returns "38624." Seriously.
From: Cor Ligthert[MVP] on 14 Dec 2009 12:34
There are many types of timers in Net while also the Time can be measured by using the timespan class and the datetime but to with the classic VB DateDiff. However, I get the idea that you simply need the stopwatch for your problem. http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx Otherwise, tell us why you need it, because telling that you had it in VB6 does not make much sense as we know how many les say types of clock classes there are. Be aware that on a multiuser multitasking OS what all windows OS's are the measured time is never exact. Cor "fniles" <fniles(a)pfmail.com> wrote in message news:#uAhw0NfKHA.3916(a)TK2MSFTNGP05.phx.gbl... > In a VB6 programs and VB.NET programs using "Imports VBDT = > Microsoft.VisualBasic.DateAndTime", we use the function Timer like so: > VB6 > MyTime = Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & Right(Format(Timer, > "#0.00"), 2) > > VB.NET > Imports VBDT = Microsoft.VisualBasic.DateAndTime > MyTime = Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." & > Right(VBDT.Timer.ToString("#0.00"), 2) > > An example of the result of MyTime: > 38624.73 > > In the above example, does 73 mean 73 miliseconds ? But, 1 seconds has > 1000 miliseconds, so that doesn't make sense. > > If the above function doesn't represent miliseond, what is the best way to > get the milliseconds ? > > Thank you > |