Android Question Need to Convert a Time Value (Float) in a special Format

DonManfred

Expert
Licensed User
Longtime User
Hello,

i´m in the need to do my own Numberformatting.
I have a Value (Float) coming from a PS4 Game.
The Value is the Seconds in the Lap of a F1 Race.

The Output must be the Minutes and Seconds plus MS

1:15.123
M SS MS

Any suggestion/help?

i remember a custom formatting posted time ago but i can´t find it anymore
 

Claudio Oliveira

Active Member
Licensed User
Longtime User
Hi Manfred,

This should work...
B4X:
Dim FormattedTime As String
DateTime.TimeFormat="mm:s.S"
FormattedTime=DateTime.Time(Value * DateTime.TicksPerSecond)
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
You mean the Java patterns?


So the pattern is "m:ss.SSS"

B4X:
Dim t As Float = 1000*60+1000*15+123
    DateTime.TimeFormat="m:ss.SSS"
    Log(DateTime.Time(t))
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Here is a 3rd option equivalent to the two above to bombard you with using string literal:
B4X:
Dim value As Double =75.123
    DateTime.TimeFormat="m:ss SSS"   
    Log($"$Time{value*DateTime.TicksPerSecond}"$ )  'displays: 1:15 123
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…