I use the time counter in seconds in B4A using the timer.
How to translate numbers in label.Text in clock format: minutes: seconds?
Attempt to apply code:
-------------------
Sub Convert Milliseconds to String (T AS LONG) AS String
Dim Hours, Minutes, Seconds AS INT
Hours = T / DateTime.ticksperhour
MINUTS = (T mod datetime.ticksperhour) / datetime.ticksperminute
Seconds = (T mod datetime.ticksperminute) / datetime.tickspersecond
Return $ "$ 1.0 {Hours}: $ 2.0 {minutes}: $ 2.0 {seconds}" $
End Sub.
--------------------
gives an error message ?
The code :
--------------------
'Converts Milliseconds to M: SS Format.
Sub ConvertTotimeFormat (MS AS INT) AS String
Dim Seconds, Minutes AS INT
Seconds = Round (MS / 1000)
Minutes = Floor (Seconds / 60)
Seconds = Seconds MOD 60
Return NumberFormat (Minutes, 1, 0) & ":" & NumberFormat (Seconds, 2, 0) 'Ex: 3:05
End Sub.
--------------------
Does not solve the desired task and works only with MediaPlayer.
Can I give an example of solving this problem?
How to translate numbers in label.Text in clock format: minutes: seconds?
Attempt to apply code:
-------------------
Sub Convert Milliseconds to String (T AS LONG) AS String
Dim Hours, Minutes, Seconds AS INT
Hours = T / DateTime.ticksperhour
MINUTS = (T mod datetime.ticksperhour) / datetime.ticksperminute
Seconds = (T mod datetime.ticksperminute) / datetime.tickspersecond
Return $ "$ 1.0 {Hours}: $ 2.0 {minutes}: $ 2.0 {seconds}" $
End Sub.
--------------------
gives an error message ?
The code :
--------------------
'Converts Milliseconds to M: SS Format.
Sub ConvertTotimeFormat (MS AS INT) AS String
Dim Seconds, Minutes AS INT
Seconds = Round (MS / 1000)
Minutes = Floor (Seconds / 60)
Seconds = Seconds MOD 60
Return NumberFormat (Minutes, 1, 0) & ":" & NumberFormat (Seconds, 2, 0) 'Ex: 3:05
End Sub.
--------------------
Does not solve the desired task and works only with MediaPlayer.
Can I give an example of solving this problem?