How to calculate twilight

Hello,
Is there any equation to calculate twilight using the available tags?

Thanks

3 Likes

#DISDAYTIME# could be the tag you are after. Returns true if time is after sunrise and before sunset.

You can use this in Opacity to hide/show an element.
e.g.
$#DISDAYTIME#==true?100:0$

If you are wanting to use this with elements that do not have Opacity attribute, such as Weather icons, you can achieve similar using the x or y fields to move element off screen.
e.g.
$#DISDAYTIME#==true?160:1000$
So if true, the element is in position 160, else it is moved off screen to position 1000.

5 Likes

Among available tags there are times of sunset and sunrise, but if you mean the time between when the sun touches horizon and completely hides or emerges, it can only be estimated

6 Likes

Dusk is between 90 and 120 minutes after sunset - I usually use sunset + 90

4 Likes

There is a theoretical method to calculate twilight in the link below, but I feel it is too complicated.
https://adsabs.harvard.edu/full/1896PA......4..148H

I was looking for a simpler way to calculate it using #LAT#, #ALT#, and date, or with respect to #WSUNSET24# and #WSUNRISE24# with a linear equation.

For the time being, I may use average value of 90 minutes near Tropic of Cancer.

Thanks for support

5 Likes