Internet tells me that Gregorian date 19th of July, year 2023 is the first of Muharram.

But when I try to calculate the moon phase via perl, (module Astro::MoonPhase), it tells me that on sunset with coordinates for Mecca ($latitude = "+21.422510"; $longitude = "+39.826168";), the moon was already more than half a day old at sunset on 18th of July.

What's wrong?

Are the results from the computation wrong, or am I missing something in the interpretation of the computation? (Maybe both?)

  • The month does not start with the birth of the new moon, rather with its sighting after sunset. The moon can only be seen when it is old enough and if the sky is clear and dark enough and if the observer's eyesight is good enough. Calculation methods can only give you a probability of seeing it depending on some assumed thresholds.
    – UmH
    Aug 11 at 12:15
  • @UmH Right you are, but the question is about calculation only, as a computer can not tell about eyesight or weather conditions. Your comment raises a whole avalanche of other questions, which I don't dare ask right now. Aug 11 at 12:20

2 Answers 2


How is the new month determined:

The months in the Islamic calendar start and end with the sighting of the new moon. The following ahadith are regarding the instructions of the Prophet ﷺ regarding Ramadan, Shawal and Dhu’l-Hijjah, and the same extends to other months:

لا تصوموا حتى تروا الهلال، ولا تفطروا حتى تروه

Do not fast unless you see the crescent (of Ramadan), and do not give up fasting till you see the crescent (of Shawwal)


عهد إلينا رسول الله صلى الله عليه وسلم أن ننسك للرؤية فإن لم نره وشهد شاهدا عدل نسكنا بشهادتهما

The Messenger of Allah (ﷺ) took a pledge from us that we should perform the rites of hajj after sighting the moon. If we do not sight it and two reliable persons bear witness, we should perform the rites of hajj on the basis of their witness.

Abu Dawud

صوموا لرؤيته وأفطروا لرؤيته وانسكوا لها فإن غم عليكم فأكملوا ثلاثين فإن شهد شاهدان فصوموا وأفطروا

Fast when you see it and stop fasting when you see it, and perform the rites on that basis. If it is obscured, then complete thirty days, and if two witnesses testify then fast and stop fasting.


اختلف الناس في آخر يوم من رمضان فقدم أعرابيان فشهدا عند رسول الله صلى الله عليه وسلم بالله لأهلا الهلال أمس عشية فأمر رسول الله صلى الله عليه وسلم الناس أن يفطروا

People differed among themselves on the last day of Ramadan (about the appearance of the moon of Shawwal). Then two bedouins came and witnessed before the Prophet (ﷺ) swearing by Allah that they had sighted moon the previous evening. So the Messenger of Allah (ﷺ) commanded the people to break the fast.

Abu Dawud

On the evening when the 29th day of a month has ended, Muslims look at the sky to search for the new crescent. If anyone manages to see it they report their testimony to the caliph (or his appointed deputy).

If a number of valid testimonies are received then the caliph will declare the start of the new month. If no valid testimonies are received then it is assumed that moon was not visible and hence the month is declared to be of 30 days.

In modern times countries have government sanctioned authorities / committees / courts who look for the moon themselves and also receive and validate testimonies from witnesses who claim to have sighted it. When they get enough reliable testimonies they announce the start of the month. This announcement gets on the internet just like any other news does.

Why your calculation is wrong?

17th July 2023 was 29th Dhu’l-Hijjah in Saudia Arabia. However the moon was not sighted that evening. The next day (18th July) the moon was sighted - although even if it hadn't been sighted the month would have ended as it can not be longer than 30 days. Hence the day after (19th July) was declared to be the 1st of Muharram. (ref khaleejtimes , gulfnews).

Your calculation is wrong because it assumes that the month starts with the astronomical new moon, or it assumes that the moon will always be visible right after the conjunction. This does not take into account all the factors governing visibility, and hence leads to a wrong answer.

As per my understanding, doing a slightly more comprehensive calculation leads to the correct outcome that agrees with what happened in reality:

  • The conjunction (birth of the new moon) happened when the time was 17th July 9:32 pm in Saudia Arabia. The Astro::MoonPhase library agrees with this as can be verified by using the phasehunt() function.

  • However the moon had already set in Saudia Arabia before that time - and gone underneath the horizon. So it was not going to be visible. (ref: timeanddate.com)

  • Hence it would only be seen on 18th July, making 19th July as the first 'day' of Muharram.

Note however that the visibility of the moon depends on more than just being born and being above the horizon ... it also depends on its brightness and size, the weather conditions, the intensity of twilight, the presence of an observer and the strength of his eyesight etc. Calculation criterion can not account for every factor and hence can only give you a probability of sighting the moon.

  • Thank yo for your elaborate explanation, where several facts (to much to mention in a comment) were new to me. Aug 18 at 16:30

The Islamic month is based on the sighting of the moon; it is not tied to the birth of the new moon, but on when that moon would become visible.

There is no universally accepted method of calculation of what counts as "visible"; the methods I know rely on a combination of age (i.e. expected size of the crescent) as well as expected elevation above the horizon, but even then there's so many factors that could affect visibility that this is a rough estimate at best. It is generally accepted that while calculations can be used to predict when and where the crescent will (or at least should) be visible, they don't actually replace the necessity to sight the crescent itself with the naked eye.

There is also some debate on whether the crescent needs to be sighted in Mecca, or if any sighting worldwide is accepted. As far as I know the mainstream view is that any worldwide naked-eye sighting reported by a reliable Muslim is considered valid.

The following chart, taken from Moonsighting.com, should give you a better idea how the sighting is calculated:

On July 17, the crescent can not be seen anywhere. On July 18, with difficulty it may be seen in Africa and parts of Southern Europe, but can easily be seen in Americas. On July 19, it can be seen in the whole world. (See visibility curves). Estimated crescent visibility curves for Muharram 1445

So while the hilal might barely have been visible on July 17th, it's practically impossible to have been observed with the naked eye due to how young it was.

On July 18th, it's very likely to have been visible in multiple countries without difficulty, as long as weather conditions permit.

Of note, the first actual reported sighting according to the above site was in India, which would've been near where the grey region ("Optical Aid to find moon") changes to cyan ("Visible if perfect conditions):

Closeup view of the above image focused on India

One other feature of the Islamic Calendar that needs to be considered here is that the Islamic day starts at sunset, not at midnight as in the Gregorian calendar. So, if the hilal is viewed at sunset on July 18th, that means that the first of Muharram actually starts at sunset on July 18th, which technically means that July 18th would simultaneously be both the last day of Dhu al-Hijja and the first day of Muharram as far as the Gregorian calendar is concerned.

This is confusing, so such calculated dates typically just refer to which day it is at the start of midnight, which is how people who use the Gregorian calendar tend to think of days anyway. Thus, a sighting at sunset on July 18th would record the first of Muharram as the next full day on the Gregorian calendar, July 19th.

  • Right you are, again. But missing my point: eyesight or not, what tells the internet about when Muharram (or any other month) starts? In old Christian and pagan folklore the day starts at sunset, or at sunrise, not artificially somewhere in the middle of the night (that's sick, but useful for mathematical time keeping). Aug 13 at 15:28
  • On the brink of being blashemical, on whos eyesight is the start of the new moths decided? Aug 13 at 15:50
  • @GyroGearloose "There is no universally accepted method of calculation of what counts as "visible"" <-- I can't speak for what calculation method whichever calendar you're looking at chooses to use.
    – goldPseudo
    Aug 13 at 19:51
  • Yes, but what method is used? If Hodsha Nassredin has poor eyesight, will it be 55 of Dhu al-Hijjah instead of 27 of Muharram? No insult meant, just asking a difficult question. Aug 14 at 19:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .