I have a similar requirement in WeeWX-WD. I use something along the lines of:
#set $moonAge = $time.gmtime($current.dateTime.raw - $almanac.previous_new_moon.raw) #set $moonDays = int(round(($current.dateTime.raw - $almanac.previous_new_moon.raw)/86400,0)) $moonAge is the time since the previous new Moon in seconds, $moonDays is the whole number of days since new Moon. Dividing by 86400 may not be daylight saving safe but it is old code and good enough for my use, YMMV :) Gary On Tuesday, 30 March 2021 at 20:13:50 UTC+10 [email protected] wrote: > This because I have 29 images of the moon in its different phases : > > #set $md = int (($almanac.moon_fullness / 3.45) +.5) > > #set $fmd = "/images/lune- "+ str ($md) +" .png " > <div class = "dans_entete"> > Lune & NBSP;: & nbsp; $almanac.moon_phase <br> $almanac.moon_fullness > & nbsp;% <br> > <br> <img alt = "$md + '" src = "$ fmd" width = "50%"> > </ div> > Le 30-03-21 à 11:05, Tom Keffer a écrit : > > Could you use > > > #set $days=$almanac.moon.moon_fullness * .2953 > <p>The moon is $days days old.</p> > > .2953 is the length of the lunar cycle, divided by 100. > > > On Tue, Mar 30, 2021 at 1:41 AM P C <[email protected]> wrote: > >> >> Hello, again me ;) >> >> I am looking for the tag of the age of the moon (in days) that goes from >> New Moon in New Moon in 29 days. This means that the full moon is between >> the 14th and the 15th day. >> >> NB: Pyephem is installed >> >> Thank you ! >> -- >> You received this message because you are subscribed to the Google Groups >> "weewx-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-user/1cfbff31-a41c-4da6-a12c-49b251e5f7e2n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/weewx-user/1cfbff31-a41c-4da6-a12c-49b251e5f7e2n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > > You received this message because you are subscribed to a topic in the > Google Groups "weewx-user" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/weewx-user/VCqOBb3Hhag/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/CAPq0zEADYLZQLTfzR30skH0yBvFDPEe3Zuw0w3vuwEGjmE5yMw%40mail.gmail.com > > <https://groups.google.com/d/msgid/weewx-user/CAPq0zEADYLZQLTfzR30skH0yBvFDPEe3Zuw0w3vuwEGjmE5yMw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/9e62f75c-5cd8-4f89-95af-fd4a521be538n%40googlegroups.com.
