12/24h (#DB#) + Leading Zero

You can put hours in 12h format without leading zero.
You can put hours in 12h format with leading zero.
You can put hours in 24h format without leading zero.
You can put hours in 24h format with leading zero.
You can let the user select the format he wishes, but you can’t have leading zero with that option…

This is particularly annoying since my watchface require aligned numbers…
(my watchface is there if you guys are curious: Toploftical - Maru Maru (24h-Blue) - watch face for Apple Watch, Samsung Gear S3, Huawei Watch, and more - Facer)

I could probably toggle the opacity of few layers depending the hour (>10) and AM/PM via a formula, but that would be quite overly complicated for something that should be built-in IMHO.

1 Like

24 (00-23) with leading zero: #DHZ#
24 (0-23) without zero: #DH#

12 (00-11) with leading zero: #DKZ#
12 (0-11) without zero:#DK#

I suggest reading Documentation: http://docs.facer.io

Huh… I already know that, but those tags don’t allow the user to change the 12/24 mode like #Db# does hence my issue.

I’ve heard that developers want to create a list of tags (that don’t yet exist) on which we will be able to vote what they should work on next.

Still no response about that from them…

Bump. You got a formula?

Try this $#DB#<10?'0'+#DB#:#DB#$

3 Likes

Thank you! I actually figured out a similar code - $#Db#<10?(0+0)#Db#:#Db#$ - to use in my new watchface but i will be using your version now (because it’s more clean). Many thanks!

$#Db#<10?0(#Db#):#Db#$
That is what I use… Greetings!

1 Like

I haven’t used Facer for a while, but I know that I had found one solution with a formula that add a leading zero when under 10 and it works with both 12h and 24h systems.
(but I forgot where I found it, so I can’t properly acknowledge the person that found it, but I didn’t create it).

$#Db#<10||#Db#>=24?(0)#DK#:#Db#$

It’s set to show 00 as midnight, I don’t know what you should change to use 24 as midnight.
Formulas using booelean logic are too complex for me, especially when the documentation think we already know what || and && means :sweat_smile:

By the way, I still think that we should have a #DB# tag with leading zero and the Facer documentations are still seriously lacking content for people who aren’t used to use formulas and stuff…

1 Like

Guys, this is funny, we have four different formulas, with “mine” being more different but we get the same results, so no one got a 01-24 version? :sweat_smile:

Ben: $#DB#<10?‘0’+#DB#:#DB#$
Xavier: $#Db#<10?(0+0)#Db#:#Db#$
Carlos: $#Db#<10?0(#Db#):#Db#$
“Me”: $#Db#<10||#Db#>=24?(0)#DK#:#Db#$

2 Likes

Thanks guys. Very good job.