From second to millisecond

Priamo

Member
Licensed User
Longtime User
Hi to all,

i have this code :

B4X:
sub button1_Click
    timestart= datetime.now
end sub

sub button2_click
    Gottime
end sub

private sub GotTime
    timestart = DateTime.now
    difftme = timestop-timestart
    gottime = DateTime.Time(difftime)
    gottime= gottime.SubString2(6,8)
    ToastMessageShow("The time is (second):" & gottime)
end sub

With this code i got a string that rapresent the time in second from start and stop, for ex. "01","08","10","00".
Instead i want a string with that rapresent the values, "03.234","08.432", in milliseconds.
How can i do it?
Thanks.
 

Mahares

Expert
Licensed User
Longtime User
I think, in order to get the milliseconds in the seconds, you need to format your time in a manner similar to this prior to executing the code:
B4X:
DateTime.TimeFormat = "hh:mm:ss.SSS a"
or
B4X:
 DateTime.TimeFormat = "HH:mm:ss.SSS"
 
Upvote 0

Priamo

Member
Licensed User
Longtime User
Oh, fantastic,

i had found it also to in the tutorial, but the sintax that i used was wrong, i had wrote so:

DateTime.TimeFormat="h:mm:ss:SSS"

but it wrong

Thanks a lot

:sign0098:
 
Upvote 0
Top