Skip to content

Instantly share code, notes, and snippets.

@dragid10
Created December 17, 2023 17:20
Show Gist options
  • Save dragid10/fb81b30eabcfa7777d35e058b6d519a9 to your computer and use it in GitHub Desktop.
Save dragid10/fb81b30eabcfa7777d35e058b6d519a9 to your computer and use it in GitHub Desktop.
Garmin Developer set 12-hr time
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";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment