DonManfred Expert Licensed User Longtime User Oct 6, 2018 #1 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
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 Oct 6, 2018 #2 Hi Manfred, This should work... B4X: Dim FormattedTime As String DateTime.TimeFormat="mm:s.S" FormattedTime=DateTime.Time(Value * DateTime.TicksPerSecond) Upvote 0
Hi Manfred, This should work... B4X: Dim FormattedTime As String DateTime.TimeFormat="mm:s.S" FormattedTime=DateTime.Time(Value * DateTime.TicksPerSecond)
KMatle Expert Licensed User Longtime User Oct 6, 2018 #3 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 Click to expand... 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
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 Click to expand... 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))
M Mahares Expert Licensed User Longtime User Oct 6, 2018 #4 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
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
Semen Matusovskiy Well-Known Member Licensed User Oct 6, 2018 #5 Take a look https://www.b4x.com/android/forum/threads/locale-jar.96761/#post-615763 smLocale.Format is based on Android Formatter class. Or you can directly use format function in java.util.Formatter Last edited: Oct 6, 2018 Upvote 0
Take a look https://www.b4x.com/android/forum/threads/locale-jar.96761/#post-615763 smLocale.Format is based on Android Formatter class. Or you can directly use format function in java.util.Formatter
Erel B4X founder Staff member Licensed User Longtime User Oct 7, 2018 #6 All developers that suggest using DateTime.Time for this, should watch the date & time video tutorial: It is a common mistake. Relevant code: https://www.b4x.com/android/forum/threads/b4x-convert-milliseconds-to-string.89851/#content Upvote 0
All developers that suggest using DateTime.Time for this, should watch the date & time video tutorial: It is a common mistake. Relevant code: https://www.b4x.com/android/forum/threads/b4x-convert-milliseconds-to-string.89851/#content