For either purpose, the status of the twilight hours just after sunset or just before sunrise is ambiguous. Judaism provides its own definitions for this period; at the same time, various rabbinic authorities differ on just how those definitions are to be applied for different purposes.
The Talmud often states calculations of these zmanim in terms of the time it takes to walk some distance, stated in mils. Most authorities reckon the time it takes to walk one mil as being 18 minutes, though there are opinions of up to 24 minutes. Many authorities hold such calculations to be absolute: if nightfall follows sundown by "the amount of time it takes to walk four mils," for example, that means exactly "72 minutes after sundown" in all places on all dates. Other authorities, especially those living in higher latitudes, noted that the darkness of the sky 72 minutes after sundown (for example) can vary substantially from place to place, and from date to date. They therefore hold that "72 minutes after sundown" actually refers to how dark the sky is 72 minutes after sundown in Jerusalem on an equinox. Then that degree of darkness is reckoned as being true when the sun has fallen a certain number of degrees below the horizon (for example, 7°5′ below the horizon), and that becomes the actual standard used for all places and all dates.
One calendar day ends, and the next day begins, during the evening. The Talmud states there is an uncertainty as to whether the day ends at sunset or nightfall, so the time in between has a status of doubt. The Talmud in Pesachim states there are four Biblical miles (mil) between sunset and nightfall. However, the Talmud in Tractate Shabbat states that there are three-quarters of a mil between sunset and nightfall.
According to the first opinion, nightfall is 13½-18 minutes after sundown (or, equivalently, the sun falls 3–4° below the horizon). According to the second opinion, nightfall occurs exactly 72 minutes after sundown (or, equivalently, the sun falls 6–16° below the horizon).
In practice, when the question is whether it is too late to do a something that must be done by day, the practice is to follow one of the earlier opinions. When the question is whether it is too early to do something that must be done by night, the practice is to follow one of the later opinions. For calculating the end of Shabbat or major holidays, the desire not to end Shabbat early, along with the Talmud's description of the end of Shabbat in terms of the appearance of stars in the sky, leads to the use of the later opinions. (See End of Shabbat below.)
There is also a difference of opinion as to when one may begin to do activities that must be done during the day:
The Talmud in Pesachim (see above) holds symmetrically that the time between daybreak and sunrise is also the time in which one can walk four mils. For morning calculations, daybreak is normally held to be when the sun is 16.1° below the horizon, or a fixed 72 minutes or 90 minutes before sunrise.
For almost all halakhic purposes, each day is divided into twelve equal "hours." There are two major opinions:
The result is that "Magen Avraham times" are earlier in the morning than "Vilna Gaon times"; in practice there are communities that follow each of those standards. For times in the afternoon, the Vilna Gaon's times are earlier, and are almost universally followed.
These are called "seasonal" or "variable" hours because they depend on the length of time between sunrise (or daybreak) and sunset (or nightfall), and those vary through the year. Near New York, for example, a "seasonal hour" based on the Vilna Gaon's calculations lasts around 45 minutes near winter solstice, around 60 minutes near the equinoxes, and around 75 minutes near summer solstice.
Daybreak (עֲלוֹת הַשַּׁחַר, Alot Hashachar) refers to when the first rays of light are visible in the morning.
Sunrise (הַנֵץ הַחַמָּה, Hanetz Hachamah) refers to when the ball of the sun rises above the horizon. Technically, it is preferable to pray the morning Shema just before this time and begin the Amidah just afterwards, although this is rarely done nowadays. Most mitzvot that must be performed during the day (such as the Four Species or Hallel) should be done after this time ab initio.
Sof Zman Kriyat Shema (סוֹף זְמַן קְרִיאַת שְׁמַע) means "end of the time to say the [morning] Shema." This is three halachic hours into the day. These hours are variable/seasonal hours and refer to one twelfth of the time between daybreak and nightfall (according to the Magen Avraham) or one twelfth of the time between sunrise and sunset (according to the Vilna Gaon).
Sof Zman Tefilah (סוֹף זְמַן תְּפִלָּה) means "end of the time to say the Shacharit Amidah." This is four (variable) hours into the day. The above comments apply here also. However, since the Amidah is only rabbinically required (unlike the Shema which is Scriptually mandated) it is common to rely on the later time, thus only a few calendars publish the earlier time.
Midday (חֲצוֹת הַיּוֹם, Chatzot Hayom or just Chatzot) means the midpoint between sunrise and sunset, or equivalently between daybreak and sundown. The absolute latest time for the Shacharit Amidah, ex post facto, is this time. On the Shabbat and on holidays, one is supposed to eat before this time (except on Rosh Hashanah). On Tish'a Ba'av one may sit on a chair at this time, and those who fast on Erev Rosh Hashanah usually eat at this time.
Minchah Gedolah (מִנְחָה גְּדוֹלָה, literally the greater Minchah), one-half variable hour after midday, is the earliest time to recite Minchah, although one should try, if possible, to wait until Minchah Ketanah (literally the smaller Minchah). On Yom Kippur, the congregation must begin Mussaf by this time, because otherwise they would be required to pray the more frequent prayer (Mincha) first.
Minchah Ketanah (מִנְחָה קְטַנָּה, literally the smaller [window of praying] Minchah), two and one-half variable hours before sunset, is the preferable earliest time to recite Minchah.
Plag Hamincha (פְּלַג הַמִּנְחָה, literally half of the Minchah) is the midpoint between Minchah Ketanah and sunset, i.e. one and one-quarter variable hours before sunset. If one prayed Minchah before this time, one may recite Maariv afterwards (at the conclusion of the Sabbath, this may only be done under extenuating circumstances). Otherwise, one must wait until sunset, unless one is praying as a congregation.
Sunset (שְׁקִיעַת הַחַמָּה, Shkiyat Hachamah - often referred to simply as ShKia/Sh'Kia/SheKia) is the time at which the ball of the sun falls below the horizon. The new day begins at this point for almost all purposes. For example, the calendar date changes.
Mitzvot that must be performed during the day may no longer be performed ab initio. Minchah should not be delayed past now. Maariv may be recited now, although many wait until after nightfall.
Sunset's calendar date change effects include knowing how to match secular date of passing away with Yartzeit date.
Bein Hashemashot (בֵּין הַשְּׁמָשׁוֹת, literally between the suns) is the period between sunset and nightfall, and is considered a time of questionable status. On the Sabbath, festivals, and fast days the stringencies of both the previous and following days apply. For example, if the fast of Tish'a Ba'av immediately follows the Sabbath, the intervening Bein Hashemashot is forbidden in eating, drinking, and working. However, there are occasional leniencies.
Nightfall (צֵאת הַכּוֹֹכָבִים, Tzet Hakochavim) is described in detail above. After nightfall, it is considered definitely the following day. All restrictions of the previous day go away, and any Mitzvot that must be performed at night (such as the evening Shema, the Seder, or Bedikas Chametz may be performed.
מוצאי שבת, the End of Shabbat (or equivalently, the end of a festival or fast), is described in the Talmud as a time when "three medium stars are [visible] in the sky." There is much discussion of what this means, and not to end Shabbat "too" early, it tends to be construed strictly in practice. There are various observed practices, all of which have support in the halachic literature:
Midnight (חֲצוֹת הַלַּילָה, Chatzot Halaylah or just Chatzot) is the midpoint between nightfall and daybreak, or equivalently between sunset and sunrise. The evening Shema should be recited by now, and the Afikoman on Passover should be eaten by this time. The Talmud in Berachot rules that all "night" mitzvot should be performed by Chatzot, at least ab initio, in case the person would otherwise fall asleep and then fail to perform the mitzvot. Some rise at this time and recite Tikkun Chatzot, a series of supplications for the rebuilding of the Temple.