Android Question MaterialDatetimePicker OnTimeSet Problem

Uederson Ferreira

Member
Licensed User
Hi all!
If I choose a time like "01:00" it returns minutes "0", and if I choose "01:05", it returns "5".
I know it is because minute returns as int. I had a lot of work trying to solve it, but I think there is an easier way.

Thank you in advanced!

Uederson
 

Uederson Ferreira

Member
Licensed User
Great!
My workaround was (if it is usefull for someone else):

B4X:
Sub time_onTimeSet (hour As Int, minute As Int, second As Int)
    If minute == 0 Then
        label.Text = hour &":00"
    Else If minute > 0 And minute < 10 Then
        label.Text = hour &":0"&minute
    Else
        label.Text = hour &":"&minute
    End If
End Sub

Thank you, friend!
 
Upvote 0

udg

Expert
Licensed User
Longtime User
B4X:
label.text = $"$2.0{hour}:$2.0{minute}"$
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
What is the "$" Character for ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…