******************************************************************************
SIMPLE LUNAR PHASE ANGLE TABLE FUNCTION DEMO
Built around the NASA/JPL Horizons API
PHP Program by Jay Tanner - 2026
This program is based on a custom function to generate a simple lunar phase
table over a given range from a single date to multiple dates spanning any
general interval at any given time step size.
This demo program generates a table of the simple geocentric lunar phase
angles for each date of the current month at 00:00:00 UTC on each date.
It is called the 'simple' lunar phase because it is geocentric and based on
the simple difference between the ecliptical longitudes of the moon and sun
at the same moment and excludes the tiny effects of librations, but still
results in a good enough lunar phase approximation for most practical pur-
poses and general small-scale graphical simulations.
-----------------
CALLING TEMPLATE:
PhaseTable = Lunar_Phase_Table (StartDateTimeStr, StopDateTimeStr, StepSize,
TimeZone, DaySumYN, HeaderYN)
*********************************************************
Geocentric Lunar Phase Table
Time Zone = UT+00:00 (dJDate = +0.0000000000)
Day/Summ Time = No
Table Header = Yes
START Date/Time = 2026-Feb-01 00:00:00 (Standard Time)
STOP Date/Time = 2026-Feb-28 00:00:00
Step Size = 1 day
=========================================================
Loc_Date Loc_Time Cnst Julian_Date_UT Phase_Ang
============ ======== ==== ================= =========
2026-Feb-01 00:00:00 Cnc 2461072.500000000 167.78616
2026-Feb-02 00:00:00 Cnc 2461073.500000000 181.00710
2026-Feb-03 00:00:00 Leo 2461074.500000000 193.92688
2026-Feb-04 00:00:00 Leo 2461075.500000000 206.49000
2026-Feb-05 00:00:00 Vir 2461076.500000000 218.67489
2026-Feb-06 00:00:00 Vir 2461077.500000000 230.49241
2026-Feb-07 00:00:00 Vir 2461078.500000000 241.98061
2026-Feb-08 00:00:00 Vir 2461079.500000000 253.19777
2026-Feb-09 00:00:00 Lib 2461080.500000000 264.21546
2026-Feb-10 00:00:00 Lib 2461081.500000000 275.11225
2026-Feb-11 00:00:00 Sco 2461082.500000000 285.96840
2026-Feb-12 00:00:00 Oph 2461083.500000000 296.86138
2026-Feb-13 00:00:00 Sgr 2461084.500000000 307.86196
2026-Feb-14 00:00:00 Sgr 2461085.500000000 319.03075
2026-Feb-15 00:00:00 Sgr 2461086.500000000 330.41525
2026-Feb-16 00:00:00 Cap 2461087.500000000 342.04756
2026-Feb-17 00:00:00 Cap 2461088.500000000 353.94327
2026-Feb-18 00:00:00 Aqr 2461089.500000000 6.10169
2026-Feb-19 00:00:00 Aqr 2461090.500000000 18.50774
2026-Feb-20 00:00:00 Psc 2461091.500000000 31.13515
2026-Feb-21 00:00:00 Psc 2461092.500000000 43.95042
2026-Feb-22 00:00:00 Psc 2461093.500000000 56.91662
2026-Feb-23 00:00:00 Ari 2461094.500000000 69.99617
2026-Feb-24 00:00:00 Tau 2461095.500000000 83.15197
2026-Feb-25 00:00:00 Tau 2461096.500000000 96.34708
2026-Feb-26 00:00:00 Tau 2461097.500000000 109.54327
2026-Feb-27 00:00:00 Gem 2461098.500000000 122.69945
2026-Feb-28 00:00:00 Gem 2461099.500000000 135.77106
*********************************************************
Table to help visualize the lunar phase angles:
PhaseAng Description
-------- -----------------
0° New Moon
45 Waxing Crescent
90 First Quarter
135 Waxing Gibbous
180 Full Moon
225 Waning Gibbous
270 Last Quarter
315 Waning Crescent
360/0 New Moon
******************************************************************************
To compute the simple geocentric lunar phase angle (0 to 360 deg) based on
the ecliptical longitudes of the moon and sun at the same moment also in the
the range from 0 to 360 degrees:
Let:
PhaseAng = Simple lunar phase angle (0 to 360 deg) based on the
difference between the ecliptical longitudes.
Given:
Lm = Geocentric ecliptical longitude of the moon (0 to 360 deg).
Ls = Geocentric ecliptical longitude of the sun (0 to 360 deg).
Then, the simple phase angle may be found
by one of the following simple algorithms:
----------------------------------------
w = 360 - Lm + Ls
if (w > 360) then w = w - 360
PhaseAng = 360 - w
----------------------------------------
Or, the alternate equivalent:
w = 360 - Lm + Ls
PhaseAng = 360 − (w −= (w > 360)? 360:0)
******************************************************************************
|