How is "the night" calculated in Islamic terms?
From sunset (Maghrib adhan) to true dawn (Fajr adhan) — not from sunset to sunrise as some mistakenly think. This is the view favored by a number of scholars based on the night including the time of Isha and night prayer until Fajr.
Why is the last third specifically the best time?
Because of the hadith of the Prophet ﷺ: "Our Lord descends every night to the lowest heaven when the last third of the night remains, and says: Who is calling upon Me that I may answer him? Who is asking Me that I may give him? Who is seeking My forgiveness that I may forgive him?" — it is the time of divine descent and a special time for answered supplication.
Where do I get accurate Maghrib and Fajr times?
From any trusted prayer times app for your city (like the official prayer times app or the Umm al-Qura calendar), or from the local muezzin's announcement. Enter the two times as they actually appear on your day to ensure result accuracy.
Does the time differ every day?
Yes, Maghrib and Fajr times change daily depending on the season and geographic location, so midnight and the start of the last third differ from day to day — recalculate with new times each time for the most accurate result.
What's the difference between "midnight" here and the midnight in the hadith about the prayer of Prophet David, peace be upon him?
The hadith "he used to sleep half the night, pray a third, and sleep a sixth" calculates the half from the time sleep becomes possible (after Isha prayer), not directly from sunset, per the note of Sheikh al-Islam Ibn Taymiyyah, while this calculator calculates "midnight" and "the last third" in the more common, widely-used sense (from sunset to Fajr) used in most contemporary fatwas regarding the time for night prayer and supplication.