# Moon phase problem. I am looking for help

Hello everyone, I’m asking for help with a little problem. I want to make a picture visible only in the full moon phase. I tried this but it does not work. Can someone help me and tell me what I’m doing wrong? Thank you.

\$((Math.round((((((((367*#Dy#-((7*(#Dy#+((#DM#+9)/12)))/4)+((275*#DM#)/9)+#Dd#+1721013.5+#Dk#/24)-0.5*((100*#Dy#+#DM#-190002.5)/abs(100*#Dy#+#DM#-190002.5))+0.5)-2451550.1)/29.530588853)-floor((((367*#Dy#-((7*(#Dy#+((#DM#+9)/12)))/4)+((275*#DM#)/9)+#Dd#+1721013.5+#Dk#/24)-0.5*((100*#Dy#+#DM#-190002.5)/abs(100*#Dy#+#DM#-190002.5))+0.5)-2451550.1)/29.530588853))29.530588853)1000)/10)/100)12.19074911753505)>=156?100:\$\$((Math.round((((((((367#Dy#-((7(#Dy#+((#DM#+9)/12)))/4)+((275#DM#)/9)+#Dd#+1721013.5+#Dk#/24)-0.5*((100*#Dy#+#DM#-190002.5)/abs(100*#Dy#+#DM#-190002.5))+0.5)-2451550.1)/29.530588853)-floor((((367*#Dy#-((7*(#Dy#+((#DM#+9)/12)))/4)+((275*#DM#)/9)+#Dd#+1721013.5+#Dk#/24)-0.5*((100*#Dy#+#DM#-190002.5)/abs(100*#Dy#+#DM#-190002.5))+0.5)-2451550.1)/29.530588853))*29.530588853)*1000)/10)/100)*12.19074911753505)>=194?0:\$\$

If you use the built-in function for the moon phase, just leave the picture of the moon and replace the others with empty ones.

OR

\$(floor(((((floor(365.25*((#Dy#-1)+4716))+(2-floor((#Dy#-1)/100)+floor(floor((#Dy#-1)/100)/4))-1096.5+#DD#+(#DH#/24+#Dm#/1440))-2451550.1)%29.530588853)/29.530588853)*100))==49?100:0\$

This is the equation for the age of the moon. The best expert in calculating the moon here is @mikeoday.

2 Likes

Full moon is actually a single moment in time. What percentage of the moons cycle are you after? That is, full_moon +/- X%, what do you want X to be?

The exact lunar period moves about a fair bit about the mean 29.53 days. The expression below compensates for this variation to some degree ( max error ~60 minutes, mean ~19 minutes ):

\$abs((((#DNOW#/2551442844-0.228535)
+0.00591997sin(#DNOW#/5023359217+3.1705094)
+0.017672776
sin(#DNOW#/378923968-1.5388144)
-0.0038844429sin(#DNOW#/437435791+2.0017235)
-0.00041488
sin(#DNOW#/138539900-1.236334))%1)-0.5)
<0.025
?100:0\$

This should make your image visible +/- 2.5% of lunar cycle about the full moon. Increase 0.025 on the second last line to make the image stay visible longer, reduce it to make the image visible for less time.

By the way, when you post the above into the Opacity field for your image make sure you delete any spaces.

I hope that helps.

3 Likes

Thank you all for your help. @mikeoday, that helps me to implement my plan. I do not need a second-exact determination of the moon phase, a certain tolerance is even desirable. Many thanks.

1 Like

Simplest formulae, based on 1/16th (6.25%) of moon cycle closest to full moon.

`\$(floor(((#DNOW#/8.64e7-6.8583)%29.5306)*0.5418)%16)=8?100:0\$`

Based on my own (and others) work here: [SOLVED] How To Tag Moon Phase Today Rotation

2 Likes