Home > Mobile >  how to change the clock format in xamarin in visual studio?
how to change the clock format in xamarin in visual studio?

Time:02-27

i want a clock who is in 24 hours format also shows the seconds, so i wrote this line of code in the texte clock

  android:format24Hour="hh:mm:ss"

my problem is, for example, now it's time 17:58:50 but the application says 5:58:50 and i want 17:58:50. Thanks for the help, and also i would like to know how did you find the answer because i did a lot of research for it and i didn't found the answer and i would like to become more independant

CodePudding user response:

You should use HH instead of hh for android:format24Hour

The "HH" custom format specifier (plus any number of additional "H" specifiers) represents the hour as a number from 00 through 23; that is, the hour is represented by a zero-based 24-hour clock that counts the hours since midnight. A single-digit hour is formatted with a leading zero.

android:format24Hour="HH:mm:ss"
                    //^^  HH uses 24-hour clock, from 00 to 23
  • Related