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
 

KMatle

Expert
Licensed User
Longtime User
You mean the Java patterns?

H hour-of-day (0-23) number 0
m minute-of-hour number 30
s second-of-minute number 55
S fraction-of-second fraction 978
A milli-of-day number 1234
n nano-of-second number 987654321
N nano-of-day number 1234000000

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
Top