Function Repository Resource:

MoonPhaseDate

Source Notebook

Compute the date of a specific phase of the Moon

Contributed by: Jeff Bryant

ResourceFunction["MoonPhaseDate"][]

computes the date of the next full moon.

ResourceFunction["MoonPhaseDate"][date]

computes the date of the next full moon after the specified date.

ResourceFunction["MoonPhaseDate"][phase]

computes the date of the next phase of the Moon.

ResourceFunction["MoonPhaseDate"][date,phase]

computes the date of the next specified phase of the Moon after the specified date.

ResourceFunction["MoonPhaseDate"][dateinterval]

computes the dates of the full moons within the specified dateinterval.

ResourceFunction["MoonPhaseDate"][dateinterval,phase]

computes the dates of the specified phase of the Moon within the specified dateinterval.

Details and Options

The values accepted for phase are "Full", "New", "FirstQuarter", "LastQuarter", "WaxingCrescent", "WaningCrescent", "WaxingGibbous", "WaningGibbous" or any of the entities from the "MoonPhase" entity type.
The date should be a DateObject.
If a date isn't specified, then Now is assumed.
ResourceFunction["MoonPhaseDate"][] is equivalent to ResourceFunction["MoonPhaseDate"][Now,"Full"].
ResourceFunction["MoonPhaseDate"] accepts the same options as DateObject in addition to TimeDirection.
The TimeDirection option accepts the following values:
1next event (default)
0nearest event
-1previous event
TimeDirection is irrelevant when a date interval is specified.

Examples

Basic Examples (6) 

Find the time of the next full moon:

In[1]:=
ResourceFunction["MoonPhaseDate"]["Full"]
Out[1]=

Next new moon:

In[2]:=
ResourceFunction["MoonPhaseDate"]["New"]
Out[2]=

Next full moon after a given date:

In[3]:=
ResourceFunction["MoonPhaseDate"][DateObject[{2023, 3, 5}], "Full"]
Out[3]=

Next new moon after a given date:

In[4]:=
ResourceFunction["MoonPhaseDate"][DateObject[{2023, 3, 5}], "New"]
Out[4]=

Find all the full moons within a date interval:

In[5]:=
ResourceFunction["MoonPhaseDate"][
 DateInterval[{DateObject[{2020, 1, 1}], DateObject[{2021, 1, 1}]}], "Full"]
Out[5]=

Find all the new moons within a date interval:

In[6]:=
ResourceFunction["MoonPhaseDate"][
 DateInterval[{DateObject[{2020, 1, 1}], DateObject[{2021, 1, 1}]}], "New"]
Out[6]=

Scope (16) 

Next first-quarter moon:

In[7]:=
ResourceFunction["MoonPhaseDate"]["FirstQuarter"]
Out[7]=

Next last-quarter moon:

In[8]:=
ResourceFunction["MoonPhaseDate"]["LastQuarter"]
Out[8]=

Next waxing crescent moon:

In[9]:=
ResourceFunction["MoonPhaseDate"]["WaxingCrescent"]
Out[9]=

Next waning crescent moon:

In[10]:=
ResourceFunction["MoonPhaseDate"]["WaningCrescent"]
Out[10]=

Next waxing gibbous moon:

In[11]:=
ResourceFunction["MoonPhaseDate"]["WaxingGibbous"]
Out[11]=

Next waning gibbous moon:

In[12]:=
ResourceFunction["MoonPhaseDate"]["WaningGibbous"]
Out[12]=

Next first-quarter moon after a given date:

In[13]:=
ResourceFunction["MoonPhaseDate"][
 DateObject[{2023, 3, 5}], "FirstQuarter"]
Out[13]=

Next last-quarter moon after a given date:

In[14]:=
ResourceFunction["MoonPhaseDate"][
 DateObject[{2023, 3, 5}], "LastQuarter"]
Out[14]=

Next waxing crescent moon after a given date:

In[15]:=
ResourceFunction["MoonPhaseDate"][
 DateObject[{2023, 3, 5}], "WaxingCrescent"]
Out[15]=

Next waning crescent moon after a given date:

In[16]:=
ResourceFunction["MoonPhaseDate"][
 DateObject[{2023, 3, 5}], "WaningCrescent"]
Out[16]=

Next waxing gibbous moon after a given date:

In[17]:=
ResourceFunction["MoonPhaseDate"][
 DateObject[{2023, 3, 5}], "WaxingGibbous"]
Out[17]=

Next waning gibbous moon after a given date:

In[18]:=
ResourceFunction["MoonPhaseDate"][
 DateObject[{2023, 3, 5}], "WaningGibbous"]
Out[18]=

Find all the first-quarter moons within a date interval:

In[19]:=
ResourceFunction["MoonPhaseDate"][
 DateInterval[{DateObject[{2020, 1, 1}], DateObject[{2021, 1, 1}]}], "FirstQuarter"]
Out[19]=

Find all the last-quarter moons within a date interval:

In[20]:=
ResourceFunction["MoonPhaseDate"][
 DateInterval[{DateObject[{2020, 1, 1}], DateObject[{2021, 1, 1}]}], "LastQuarter"]
Out[20]=

Find all the waxing crescent moons within a date interval:

In[21]:=
ResourceFunction["MoonPhaseDate"][
 DateInterval[{DateObject[{2020, 1, 1}], DateObject[{2020, 4, 1}]}], "WaxingCrescent"]
Out[21]=

Find all the waning crescent moons within a date interval:

In[22]:=
ResourceFunction["MoonPhaseDate"][
 DateInterval[{DateObject[{2020, 1, 1}], DateObject[{2020, 4, 1}]}], "WaningCrescent"]
Out[22]=

Find all the waxing gibbous moons within a date interval:

In[23]:=
ResourceFunction["MoonPhaseDate"][
 DateInterval[{DateObject[{2020, 1, 1}], DateObject[{2020, 4, 1}]}], "WaxingGibbous"]
Out[23]=

Find all the waning gibbous moons within a date interval:

In[24]:=
ResourceFunction["MoonPhaseDate"][
 DateInterval[{DateObject[{2020, 1, 1}], DateObject[{2020, 4, 1}]}], "WaningGibbous"]
Out[24]=

Options (9) 

Compute the next full moon in a specific time zone:

In[25]:=
ResourceFunction["MoonPhaseDate"]["Full", TimeZone -> 0]
Out[25]=

Compute the nearest full moon:

In[26]:=
ResourceFunction["MoonPhaseDate"]["Full", TimeDirection -> 0]
Out[26]=

Compute the previous full moon:

In[27]:=
ResourceFunction["MoonPhaseDate"]["Full", TimeDirection -> -1]
Out[27]=

Compute the nearest new moon:

In[28]:=
ResourceFunction["MoonPhaseDate"]["New", TimeDirection -> 0]
Out[28]=

Compute the previous new moon:

In[29]:=
ResourceFunction["MoonPhaseDate"]["New", TimeDirection -> -1]
Out[29]=

Compute the nearest first quarter moon:

In[30]:=
ResourceFunction["MoonPhaseDate"]["FirstQuarter", TimeDirection -> 0]
Out[30]=

Compute the previous first quarter moon:

In[31]:=
ResourceFunction["MoonPhaseDate"]["FirstQuarter", TimeDirection -> -1]
Out[31]=

Compute the nearest last quarter moon:

In[32]:=
ResourceFunction["MoonPhaseDate"]["LastQuarter", TimeDirection -> 0]
Out[32]=

Compute the previous last quarter moon:

In[33]:=
ResourceFunction["MoonPhaseDate"]["LastQuarter", TimeDirection -> -1]
Out[33]=

Version History

  • 2.0.2 – 02 February 2021
  • 2.0.1 – 30 October 2020
  • 2.0.0 – 29 October 2020
  • 1.0.0 – 29 October 2020

Related Resources

License Information