"Until the twenty-first day." Rav Ashi said: This that you say, that there must be a night and a day from the month — from where do we derive it? Rabbi Yochanan said: from "from evening to evening you shall keep your rest" (Leviticus 23:32). Reish Lakish said: from "until the twenty-first day of the month in the evening." What is the difference between them? Midnight is the difference between them. It has been taught: "from the first day until the seventh day" — one might think the first but not the first included, the seventh but not the seventh included, in the manner that it is said "from his head to his feet" (Leviticus 13:12), his head but not his head included, his feet but not his feet included. Scripture therefore says, "until the twenty-first day of the month in the evening." Rabbi says: it is unnecessary; "first" means the first is included, "seventh" means the seventh is included.
Reckoning the Night and Day of the Festival From Evening to Evening
Yalkut Shimoni on Torah 202:4
עַד יוֹם הָאֶחָד וְעֶשְׂרִים. אָמַר רַב אַשִׁי הָא דְּאַמְרֵת צָרִיךְ שֶׁיְּהֵא לַיְלָה וְיוֹם מִן הַחֹדֶשׁ מִנָּלָן, רַבִּי יוֹחָנָן אָמַר (ויקרא כג, לב) "מֵעֶרֶב עַד עֶרֶב תִשְׁבְתוּ שַׁבַּתְּכֶם". רֵישׁ לָקִישׁ אָמַר עַד יוֹם הָאֶחָד וְעֶשְׂרִים לַחֹדֶשׁ בָּעֶרֶב מַאי בֵּנַיְיהוּ, חֲצוֹת לַיְלָה אִיכָּא בֵּנַיְיהוּ. תַּנְיָא "מִיּוֹם הָרִאשֹׁן עַד יוֹם הַשְּׁבִעִי", יָכוֹל רִאשׁוֹן וְלֹא רִאשׁוֹן בִּכְלַל, שְׁבִיעִי וְלֹא שְׁבִיעִי בִּכְלַל, כְּעִנְיָן שֶׁנֶּאֱמַר (ויקרא יג, יב) "מֵרֹאשׁוֹ וְעַד רַגְלָיו" "רֹאשׁוֹ" וְלֹא רֹאשׁוֹ בִּכְלַל "רַגְלָיו" וְלֹא רַגְלָיו בִּכְלַל. תַּלְמוּד לוֹמַר עַד יוֹם הָאֶחָד וְעֶשְׂרִים לַחֹדֶשׁ בָּעֶרֶב. רַבִּי אוֹמֵר, אֵינוֹ צָרִיךְ, "רִאשׁוֹן" רִאשׁוֹן בִּכְלַל, "שְׁבִיעִי" וּשְׁבִיעִי בִּכְלַל.