On the 14th of Nissan Klal Yisrael shechted their Korban Pesach, on the 15th of Nissan they left Mitzrayim, and on the 21st of Nissan they experienced the miracle of Kriyas Yam Suf. Consequently, on Shevii Shel Pesach we read the pasukim in the Torah that speak about Kriyas Yam Suf and Shiras HaYam.
The minhag Yisrael in many places is to sing Shiras HaYam on the night of Shevii Shel Pesach, b’rov am [together with lots of people]. Some are particular to say it at chatzos [midnight], below we will discuss the sources for the various different minhagim, when the best time to recite Shiras HaYam is, and we will also discuss the opinions of those who hold not to sing it altogether.
When Did Kriyas Yam Suf Happen?
In the pasukim which discuss Kriyas Yam Suf, we find three different pasukim: 1) ויט משה את ידו על הים ויולך ה' את הים ברוח קדים עזה כל הלילה וישם את הים לחרבה ויבקעו המים – “Moshe stretched out his hand over the sea, and Hashem moved the sea with a strong east wind all the night, and He turned the sea to dried land and the water split” (Shemos 14:21). 2) ויהי באשמרת הבקר וישקף ה' אל מחנה מצרים בעמוד אש וענן ויהם את מחנה מצרים – “It happened at the morning watch that Hashem looked down at the camp of Egypt with a pillar of fire and a cloud, and he confounded the camp of Egypt” (Shemos 14:24). 3) ויט משה את ידו על הים וישב הים לפנות בקר לאיתנו ומצרים נסים לקראתו וינער ה' את מצרים בתוך הים – Moshe stretched out his hand over the sea, and toward morning the sea went back to its power as the Egyptians were fleeing toward it; and Hashem churned Egypt in the midst of the sea” (Shemos 14:27).
In the meforshei haTorah we find three different opinions as to when the sea split, when Klal Yisrael passed through it on dry land, and when the Mitzriyim drowned.
1) Chatzos HaLeilah [Midnight]
Rashi on pasuk 24, explains that the night is split into three parts, and each part is known as an “ashmores”. Each mishmor has a different group of malachim singing Shirah to Hashem, and the third and final mishmor of the night is known as “ashmores haboker” [the morning watch]. In pasuk 27, Rashi explains the works of the pasuk, לפנות בוקר – “Towards morning”, to mean: לעת שהבוקר פונה לבוא – At the time the morning is about to arrive. According to Rashi the Yam Suf split during the night and Klal Yisrael passed through it, and during the final third of the night המהומה במחנה מצרים – there was confoundment in the camp of Egypt, and towards the morning: שב הים לאיתנו לתקפו הראשון – the sea returned to its original strength.
The Panim Yafois (Shemos 14:22) brings from his father, that at chatzos the sea split and don’t say that it happened towards the end of the night like the simple reading of pasuk 21 -ויולך ה' את הים ברוח קדים עזה כל הלילה וישם את הים לחרבה ויבקעו המים, as “ashmores haboker” refers to the last three hours of the night, and by that time המהומה במחנה מצרים – the confoundment in the camp of Egypt already started, as is clear from pasuk 24 - ויהי באשמרת הבקר וישקף ה' אל מחנה מצרים, therefore, the pasuk which says - ברוח קדים עזה כל הלילה ... ויבקעו המים, must mean that for half the night there was a strong east wind, and during the other half the sea split, and it split at chatzos.
We find a similar idea in Yoma (20a) regarding the mitzvah of terumas hadeshen. One pasuk says: כל הלילה והקטיר – “They offered it up all night” and another pasuk says: כל הלילה והרים – “They removed the ashes all night”, these pasukim contradict each other, did they offer it up all night, or did they remove ashes all night? The Gemara answers: חלקהו חציו להקטרה וחציו להרמה – “Split the night into two, half was for offering up, and half was for removing the ashes.”
It comes out that Klal Yisrael travelled through the Yam Suf for roughly three hours, and at “ashmores haboker” when Klal Yisrael exited, then Pharaoh and his army entered into the Yam Suf.
It's also clear from the Chavas Yair (Shu”t siman 225) which we will mention below, that the splitting of the sea and the drowning of the Mitzriyim happened at night, and in the morning Klal Yisrael sang Shirah.