Can I display prev/next Hr/min/sec?

When using text #Db#, is it possible to display #db#-1 and #Db#+1 on text and have it calculated?
Similarly for #Dm# and #DUs#

Ideally want to display:

(prev hr) (Hr) (next Hr)
(prev min) (Min) (next Min)
(prev sec) (Sec) (next Sec)

on the watchface.

1 small step forward, figure can do (#Dm#-1)

However if the min is 00, I get -1, anyway to wrap back to 59?
Similarly for sec 59, want the next sec to display 00 instead of 60 when using (#DsZ#+1)

In the past with WatchMaker, can do something like:
{dsz}==0 and 59 or {dsz}-1
Is there an equivalent for Facer?

My Work-In-Progress Design:

Previous time digits

First number of hours $(#DhZA#-1)>-1?(#DhZA#-1):(#DhZA#+2-1)$
Second number of hours $(#DhZB#-1)>-1?(#DhZB#-1):(#DhZB#+9)$

First number of minutes $((floor(#DUm#/10))-1)>-1?((floor(#DUm#/10))-1):((floor(#DUm#/10))+5)$
The second number of minutes $((#DUm#%10)-1)>-1?((#DUm#%10)-1):((#DUm#%10)+9)$

First number of seconds $((floor(#DUs#/10))-1)>-1?((floor(#DUs#/10))-1):((floor(#DUs#/10))+5)$
Second number of seconds $((#DUs#%10)-1)>-1?((#DUs#%10)-1):((#DUs#%10)+9)$

The next time digits

First number of hours $(#DhZA#+1)<2?(#DhZA#+1):(#DhZA#-2+1)$
Second number of hours $(#DhZB#+1)<10?(#DhZB#+1):(#DhZB#-10+1)$

First number of minutes $((floor(#DUm#/10))+1)<6?((floor(#DUm#/10))+1):((floor(#DUm#/10))-6+1)$
The second number of minutes $((#DUm#%10)+1)<10?((#DUm#%10)+1):((#DUm#%10)-10+1)$

First number of seconds $((floor(#DUs#/10))+1)<6?((floor(#DUs#/10))+1):((floor(#DUs#/10))-6+1)$
Second number of seconds $((#DUs#%10)+1)<10?((#DUs#%10)+1):((#DUs#%10)-10+1)$

Thanks lucky.andrei for the formula, will have to study yours for a bit to understand the logic

Manage to get (prev/next +/- 1) working for Hr & Min, with following:
Previous hour works using $(#Db#-1)=0?12:(#Db#-1)$
Next hour works using $(#Db#+1)=13?1:(#Db#+1)$

Previous minute work using $(#Dm#-1)=-1?59:(#Dm#-1)$
Next minute works using $(#Dm#+1)=60?0:(#Dm#+1)$

Now have to figure out: (pre/next +/-2) and (pre/next +/-3)
Special scenario:
(minute = 58,59,00,01)
(second = 58,59,00,01,02)

Can I use boolean for (#Dm#-2) as it has 2 condition: if -2 (want 58) and if -1 (want 59)
(#Ds#-3) can have -3, -2, and -1

Once I figure the previous 3 sec, the next 3 sec is similar concept

Something similar to following (not sure if I explain clearly or not). Kind-of nested if scenario?

For (#ds#-3)
If #Ds#==0, then display 57 or if #Ds#==1, then display 58 or if #Ds#==2, then display 59, else use #Ds#-3

With watchmaker, the equivalent tag would be:
{dsz}==0 and 57 or {dsz}==1 and 58 or {dsz}==2 and 59 or {dsz}-3

Have enabled Inspect mode:

Any help on tag for ‘Prev 2 min’, ‘Next 2 min’, ‘Prev 3 sec’ and ‘Next 3 sec’ will be appreciated.

ALL Resolved :slight_smile:

Solution:
$(#Db#-1)=0?12:(#Db#-1)$
$(#Db#+1)=13?1:(#Db#+1)$

$(#Dm#-2)=-2?58:(#Dm#-2)=-1?59:(#Dm#-2)$
$(#Dm#-1)=-1?59:(#Dm#-1)$
$(#Dm#+1)=60?0:(#Dm#+1)$
$(#Dm#+2)=61?1:(#Dm#+2)=60?0:(#Dm#+2)$

$(#Ds#-3)=-3?57:(#Ds#-3)=-2?58:(#Ds#-3)=-1?59:(#Ds#-3)$
$(#Ds#-2)=-2?58:(#Ds#-2)=-1?59:(#Ds#-2)$
$(#Ds#-1)=-1?59:(#Ds#-1)$
$(#Ds#+1)=60?0:(#Ds#+1)$
$(#Ds#+2)=61?1:(#Ds#+2)=60?0:(#Ds#+2)$
$(#Ds#+3)=62?2:(#Ds#+3)=61?1:(#Ds#+3)=60?0:(#Ds#+3)$

1 Like

Please note that these nested conditions do not work on all watches.
Also, you are using #Db#, which is 12h or 24h based on a users preference. Your expression is made for 12h mode only, so you should use #Dh# instead.

Here is one I made for someone on the forum that asked for something similar, using modulus (with leading zeros if needed).
Inspection is enabled:

Without leading zeros it will be as simple as (well the hours are a bit complicated, but the minutes and seconds are not):
(((#Dh#+10)%12)+1)
((#Dh#%12)+1)

((#Dm#+58)%60)
((#Dm#+59)%60)
((#Dm#+1)%60)
((#Dm#+2)%60)

etc

Pre Hr (((#Dh#+10)%12)+1)?
Next Hr (((#Dh#+10)%12)+3)?

Having some weird when clock is midnight (00:00), 12:00, 13:00 and 14:00 for previous and next hour.

That expression is for 12h clock, not 24h.
It would be something like
(((#Dk#+22)%24)+1)
Look in inspection mode if you want to increase the hours more than 1

Can I change formula from (((#Dh#)%12)+1) to (((#Dk#+22)%24)+1) when the user flip 12/24H switch?

Will use following for now, thank you for ALL the help!
(((#Dh#+10)%12)+1)
(#Db#)
(((#Dh#)%12)+1)

(((#Dm#+58)%60))
(((#Dm#+59)%60))
(#DmZ#)
(((#Dm#+1)%60))
(((#Dm#+2)%60))

(((#Ds#+58)%60))
(((#Ds#+59)%60))
(#DsZ#)
(((#Ds#+1)%60))
(((#Ds#+2)%60))

Hi @michael.ding, I don’t think the hours work the way you have now.
It all depends a little what you want. I am assuming this:

  • You want automatic switch between 12h and 24h
  • You want 24h shown as 0 tot 23 (default), not 1 to 24
  • You don’t want leading zeros

If any of those should be different, let me know, the expressions will change.
Hours:
-2: $#DTIMEFORMAT#==24?((#DH#+22)%24):(((#Dh#+10-1)%12)+1)$
-1: $#DTIMEFORMAT#==24?((#DH#+23)%24):(((#Dh#+11-1)%12)+1)$
0: #Db#
+1: $#DTIMEFORMAT#==24?((#DH#+1)%24):(((#Dh#+1-1)%12)+1)$
+2: $#DTIMEFORMAT#==24?((#DH#+2)%24):(((#Dh#+2-1)%12)+1)$