Skip to content

icon picker
Coda Moon Formula

In case you don’t want the pack but just a basic reference to the current lunar phase (without other interesting and super geeky information), here’s a genuine, full-Coda formula to calculate lunar phase with a given date (you can edit info on ):
Select Date:
4/18/2022
[Show Southern Hemisphere?
]
Moon Phase on
4/18/2022
is :
5
Waning Gibbous Moon 🌖

Code (calc_MoonPhase named variable above)
calc_Date.WithName(date,
If(date.Month() < 3, date.Year() - 1, date.Year())
.WithName(year,

WithName(
If(date.Month() < 3, date.Month() + 12, date.Month()) + 1,
month,
date.Day().WithName(day,
WithName(
((365.25 * year + 30.6 * month + day - 694039.09) /
29.5305882),
jd,

Round(((jd.Truncate() - jd) * -1) * 8)
.WithName(
phase, if(phase = 8, 0, phase)
)
)
)
)
)
)



Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.