What's the best way to determine if the user has set the "24-hour clock" setting to true in Settings-Date+Time on the Windows Phone ?
Can I get this information through the CurrentCulture (CultureInfo) ? I had no luck in finding it.
The system clock type can be retrieved using:
string clockType = Windows.System.UserProfile.GlobalizationPreferences.Clocks.FirstOrDefault();
This will return the string 24HourClock
if the 24 hour setting is on in the device settings or 12HourClock
if the setting is off.
On the back of Dennis' answer, you should be able to determine 24-hour time using String.Contains
:
bool is24HourTime = DateTimeFormatInfo.CurrentInfo.ShortTimePattern.Contains("H");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With