Help with Settings for 12 Hour Format instead of Military Format

Does anyone know how to add the 12 Hour format on the watch face settings? My watch face currently displays a Military Format option for the user.

I have tried researching a list of commands similar to the propertyKey for military format...but have had no luck. Any help is truly appreciated!

    <setting propertyKey="@Properties.UseMilitaryFormat" title="@Strings.MilitaryFormatTitle">

  • On my watch the 12/24 hour setting is in

    Settings->System->Time->Time-Format

    You can use it for example like this:

    var time = Gregorian.info(Time.now(), Time.FORMAT_SHORT);
    var deviceSettings = System.getDeviceSettings();
    var is24Hour = deviceSettings.is24Hour;
    var hour = is24Hour ? time.hour : 1 + (time.hour + 11) % 12;
    var pmString = time.hour >= 13 ? "PM" : "AM";

  • Hello, and thank you.

    Do you know if this string will interfere with what I already have? The settings already has the Military Format for 24 hour time. I'd like to offer the "normal" 12 time format view, if possible.

    I am currently using:

          if (system==false) {

                    hour = hour%12;

                if (hour==0) {hour=12;} 

                 

            } else {

                if (Application.getApp().getProperty("UseMilitaryFormat")) {

                    timeFormat = "$1$$2$";

                    hour = hour.format("%02d");

  • I don't know what you mean by "string will interfere". The possibility to choose between 12 or 24 hours is in the built in system settings as I said, but it won't interfere with anything unless you write your own code to use it.

    The problem with military format is that there is a built in setting for that too, but there is no way for the application to access it. (Thanks Garmin.) The only solution is to implement your own setting for it as you did above, but now you have two different settings for military time of which one doesn't work for your app, which I think is confusing for the user.

    You could also implement your own setting for 12/24 hour format of course, but it would be confusing for the same reason. Personally I would skip the military time thing. I don't think it is used much anyway.

  • I do agree with you. It is definitely more useful to have the 12/24 hour format/option. I'll give it a try on my end.

    But what would be the nomenclature for the setting property?

        <setting propertyKey="@Properties.Use______" title="@Strings.______FormatTitle">

  • you don't need a property for 12/24 hours.  You use System.getDeviceSettings().is24Hour

    In the sim, Settings>Time Display allows you to pick 12 or 24 hour.  On the watch, it's part of the firmware settings.

    Settings>System>Time

  • Hey Jim,

    Yes, the sim does allow me to switch b/w 12 or 24 hour. It also works in the firmware of the watch.

    My goal is to provide a useful option to the user in the settings display of either 12 or 24 hour or military. If that is possible at all...

  • It's very possible. One way is to use a list for the setting with the three choices.

  • That is great. I have researched in the developers guide for a list of nomenclature for the hour settings, but have not found a proper list.

    Would it be something like this writing in the .xml files?

    12 Hour

        <setting propertyKey="@Properties.UseSimpleDateFormat("hh:mm aa");" title="@Strings.SimpleDateFormat("hh:mm aa")FormatTitle">

    24 Hour

        <setting propertyKey="@Properties.UseSimpleDateFormat("HH:mm aa");" title="@Strings.SimpleDateFormat("HH:mm aa")FormatTitle">