I am trying to create a sunset countdown timer. I am stumped on how to from the equation. Anybody have a suggestion?

(round(((#WSH#+#WSm#/60)-(#DH#+#Dm#/60))/1))h (round(((#WSH#*60+#WSm#)-(#DH#*60+#Dm#))%60))m to sunset

As usual this editor eats moltiplication factorâ€¦ Between hashtag and 60 for exampleâ€¦

`(round(((#WSH#+#WSm#/60)-(#DH#+#Dm#/60))/1))h (round(((#WSH#*60+#WSm#)-(#DH#*60+#Dm#))%60))m to sunset`

Dario if you use Preformatted text, editor does not eat anything

I am too old for stuff like thisâ€¦ I write: thatâ€™s all!

Thank you so much, this works like a charm!

Here is a link to the watch face I have created. I might make some sexier versions in the future, but right now I wanted simple function.

Thank you again.

So this gets interesting.

When we are within about 120-0 minutes before sunset, we get very strange results. Sample: we are 45m to sunset, however this equations is returning 1h30m

I am kind of stumped on how to trouble shoot, I am thinking rounding might be the problem, or the divide by 1 in the h part.

What are your thoughts?

And one more fun one.

So I take this concept and reverse it for a sunrise count down a night:

(round(((#WRH#+#WRm#/60)-(#DH#+#Dm#/60))/1))h (round(((#WRH#60+#WRm#)-(#DH#60+#Dm#))%60))

Works, however reversing because the day is split for nighttime between 2 days we end up with a negative number. During the night before the next day.

My thinking is it might need a <0 kind of perameter or + 24 h in the first aspect of the equation.

I have to say i am stumped and quite fascinated with this equation.

Plus I have seen no other watch faces that count down from sunset or sun rise.

I have a sunrise countdown too

With the issue that you wrote of strange results I have to studyâ€¦it is not simple into creator simulating so long period

You have found a bug!

For (round(((#WSH#+#WSm#/60)-(#DH#+#Dm#/60)-0.5)/1))h (round(((#WSH#*60+#WSm#)-(#DH#*60+#Dm#))%60))m

For $#DH#<24&&#DH#>#WRH#?(round((24+(#WRH#+#WRm#/60)-(#DH#+#Dm#/60)-0.5)/1))h (round((1440+(#WRH#*60+#WRm#)-(#DH#*60+#Dm#))%60))m:(round(((#WRH#+#WRm#/60)-(#DH#+#Dm#/60)-0.5)/1))h (round(((#WRH#*60+#WRm#)-(#DH#*60+#Dm#))%60))m$

I have to add " - 0,5 " into the hours due to the â€śroundâ€ť function approssimation at the 1 over 0,5 instead 0

good job man!

This works!

Great Job Dario!

Here is a draft version I have worked on. Facer - Thousands of FREE watch faces for Apple Watch, Samsung Gear S3, Huawei Watch, and more

Right now the function all looks correct, so I am going to start designing layouts next. Thanks again for all your help!

Well, I thought we had it, but we are still getting a math error.

So in this screen shot, our sunset time should be 4h 30m (or 31m) put we are returning 4h 51m

Hmm I am going to ponder on this.

any thoughts.

Maybe add -0,5 into round function also in the part of the minutes

wellâ€¦ I have made some tests with my faces and I cannot replace the issueâ€¦

Here is my current best equasion for sunset:

(round(((#WRH#-#DH#)+24))-((floor(((#WRH#-#DH#)+24)/24))*24))h (((#WRm#-#Dm#)+60)-((floor(((#WRm#-#Dm#)+60)/60))*60))m

The problem still arise that when the hour is less than 1, it shows 1

example: if sunset is at 6:34 adn the time is at 5:41 the sunset is returning 1h 53m

the correct answer would be be 53

For the life of me, I just can not crack this math. My feeling is I need to make the hour into a decimal, like 1.1 hrs then I could take it to the floor when less than 1.

My second thought was to work the transparency to hide the hour if sunset is less than 60 minutes out.

Any ideas on this?

I have beat the equation!

Sunset

(floor((((#WSH#*60)+#WSm#)-((#DH#*60)+#Dm#))/60))h

(((#WSm#-#Dm#)+60)-((floor(((#WSm#-#Dm#)+60)/60))*60))m

So the concept was to convert hours and minutes into total minutes in the day. Then floor the equation so when less than 1 it drops off the bottom to zero.

Try to add -0.5 into round function