Need advice on sunrise and sunset functions

I need to use sunrise and sunset hour and min tags to show different pictures in day time and night time.

Day:
$#WRH#*60+#WRm#<=#DH#*60+#Dm#&&#DH#*60+#Dm#<#WSH#*60+#WSm#?100:0$

Night:
$#WRH#*60+#WRm#>#DH#*60+#Dm#||#DH#*60+#Dm#>=#WSH#*60+#WSm#?100:0$

One hour before sunset:
$#WSH#*60+#WSm#-60<=#DH#*60+#Dm#&&#DH#*60+#Dm#<#WSH#*60+#WSm#?(60-((#WSH#-#DH#)*60+#WSm#-#Dm#))*1.6666:0$

I have many elements which requires expressions above, so the smooth seconds of watch become jitter. I want to use DISDAYTIME because it can shorten the expressions and DISDAYTIME also includes seconds but WRh, WRm, WSh, WSm…etc do not. However, it seems DISDAYTIME function does not work. In day time the functions still outputs “false”.

Also, I cannot use DISDAYTIME to find out the time of 1 hour before sun set and 1 hour after sun rise.

So can you give me some advice?

My watch:
https://www.facer.io/watchface/ZYaysEuuEZ

1 Like

Here is what I have been using for day and night:

$#DISDAYTIME#=1?100:0$

Or

$#DISDAYTIME#==true?100:0$

The 1 or true is for day - change to 0 or false for night

1 Like

I have found that WearOS does not like displaytime=1 those watches will only work with displaytime==true or ==false. WearOS is picky about coding in the watch faces for some reason.

1 Like

I just tried it out, simply to display 2 different Sun and Moon Icons at the correct times, but it didn’t work, and I tried both tags, the 0/1 and the true/false. Can you tell me what I’m doing wrong please?

Assuming you want the moon & stars to show after sunset or before sunrise you would use $#DISDAYTIME#==false?100:0$ and for the sun during the daytime you would use $#DISDAYTIME#==true?100:0$ both in the opacity box. In Facer creator you have to be set to today’s date in the “Time Machine” or the opacity tags for day and night will not function. (that’s an issue with creator)

1 Like

Ah, thanks for that. I was fast forwarding to check it worked, so that’s obviously my mistake :joy:

If you set your time to 8:30 in the time machine and then just toggle the am/pm button you can easily check the function of the “DISDAYTIME” tag.

2 Likes

Cool, I’ll try that soon thanks, just creating another masterpiece right now :grin:

Is there also a Tag to display Text during AM but not PM and Vice Versa?

Safest would be something like $#DH#<12?AM:PM$
or $#DH#<12?100:0$ in opacity for AM and $#DH#<12?0:100$ for PM

1 Like

Thanks ThaMattie, much appreciated :+1:

Works perfectly thanks ThaMattie, just used it here -

Animated Arc Reactor Face

1 Like

I am using Galaxy watch 3. The Facer creator seems ok but in the watch seems all combinations are failed.
See below (actual time is day time at this moment):

You can try to check for 0 and 1 by adding parentheses:
$(#DISDAYTIME#)==0?night:day$

Does the sunset and rise show correctly?
Also, mine was delayed often. It would show day untill 10 to 40 minutes after sunset before it changed to night…

I found that the bug is due to old version of facer companion. Now I use newer version of facer companion in watch. seems OK now. THanks! :grin:

2 Likes

That’s great redskyhk, happy you got it resolved :slightly_smiling_face:

Thanks again mrantisocialguy (totally incorrect name for you on here :joy: :rofl:)

1 Like