HI,all.
how can i format the line of code bellow to have the decimals of seconds?
VB Code:
data_time = Format(datacurr_tempo, "hh:mm:ss")
Thanks.
Printable View
HI,all.
how can i format the line of code bellow to have the decimals of seconds?
VB Code:
data_time = Format(datacurr_tempo, "hh:mm:ss")
Thanks.
Give an example of the output you want?
I think this is what he's looking for:
90 seconds = 1min 30sec = 1.5 min....
There isn't a way to do so with the format function.... you'll need to create your own. The calculation is simple though, get the number of seconds remaining and divide by 60... that will give you the decimal minute.
-tg
Hmm... I think he wants the output to looks something like 7:31:23.127 (hh:mm:ss.decimals). To be honest I don't think you can do that with the normal date/time functions since they don't contain fractions of a second.
Hi, Techgnome and Penagate.
Thanks, but i think you guys didn´t understand what i´m looking for, what i want to do is
save the system time in (hh:mm:ss:??) decimal of the seconds.
Ok, if this is not possible how can i add a second to a given time?
Thanks.
You can add a second to a time using the DateAdd function.VB Code:
MsgBox DateAdd("s", 1, Now) 'add 1 second to the current date/time
VB Code:
Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) Private Type SYSTEMTIME wYear As Integer wMonth As Integer wDayOfWeek As Integer wDay As Integer wHour As Integer wMinute As Integer wSecond As Integer wMilliseconds As Integer End Type Private Sub Form_Load() Dim sTime As SYSTEMTIME GetLocalTime sTime With sTime Debug.Print .wHour & ":" & .wMinute & ":" & .wSecond & "." & .wMilliseconds End With End Sub
Thanks, Bushmobile.
But now i have another question?
- His possible to compare times in this way?,like for example:
if time1>time2 then
Thanks again?
sure, just compare the numbers.
however if you're looking to measure short periods of time then you should check out the GetTickCount API and the more accurate QueryPerformance APIs