Android Code Snippet [B4X] check if the time format is 12h or 24h format

I needed a way to check if the user lives in 12h or 24h time format to give him the possibility to show an AM/PM switch when selecting a time.

There may be a better way to check this, but if I display the following code on an affected device, I see an "a" at the end which indicates AM/PM.
Log(DateTime.DeviceDefaultTimeFormat) 'h:mm a

Public Sub is12hTimeFormat As Boolean
    If DateTime.DeviceDefaultTimeFormat.ToLowerCase.Contains("a") Then
        Return True
        Return False
    End If
End Sub


Licensed User
Longtime User
In a 24h time format the hour symbol is "H".
In a 12h time format the hour symbol is "h".
So you could check with :
TwelveHourFormat = DateTime.DeviceDefaultTimeFormat.Contains("h")