Android Question Format for DateTime.TimeFormat strings

Gary Milne

Active Member
Licensed User
Longtime User
I'm just trying to get it to return an AM/PM string. Even using the default format from the ToolTip help generates a compiler error.

Screen Shot 2014-07-27 at 4.06.50 PM.png


Took me a while to find the documentation but I thought that would be easy after that. Tried a few suggestions from the documentation such as "h:mm a" "hh:mm:ss a" but nothing works.

Can't find any pointers on this forum either. I know it must be a common issue as the US does not use 24 hour time much.
 

ivan.tellez

Active Member
Licensed User
Longtime User
Thats easy, and its on the android documentation:

DateTime.png


But the main problem is your code, its all wrong, TimeFormat its a property, not a function, and even the intellisense is telling you that you have errors.

So, for 24h its:
B4X:
DateTime.TimeFormat = "HH:mm:ss"

And for AM/PM its:
B4X:
DateTime.TimeFormat = "KK:mm:ss a"
 
Upvote 0

Gary Milne

Active Member
Licensed User
Longtime User
Aaah, thank you Ivan. So used to typing the "(" to get the help I overlooked the obvious that it was not required. thanks again.
 
Upvote 0
Top