Megilah 11b states that Yehoyachin was captured in the 8th year of Nevuchadnetzar, and the destruction of the Beit Hamikdash was in the 19th year of Nevuchadnetzar (with 11 years between the two, Erachin 12a). The destruction of the first Beit Hamikdash was in 3338. Nevuchadnetzar’s reign therefore started in 3020, and Yehoyachin’s capture was in 3027.
Megilah further counts 45 years for Nebuchadnezzar’s rule. Melachim 2:25:27 states that Evil Merdoch ruled from Adar of the 37th year of Yehoyachin’s capture. Megilah counts the 37th year for Nebuchadnezzar (because he ruled at the beginning of it) and adds another 8 years (before the 37) for 45 years. It then adds 23 years for Evil Merdoch and 2 years of Belshazzar for 70 years. Since they were not redeemed, Belshazzar made a party in his third year.
Since 8 years were added for Nebuchadnezzar’s rule (instead of 7 before the 8th year), this means that the 37 years of Yehoyachin start counting from the year after his capture. Erachin 12a similarly explains Ezekiel 40:1 that the 14 years from the destruction does not include the year of the destruction, and the 25 years from Yehoyachin’s capture does not include the year of his capture.
Megilah continues that Achashverosh thought that Belshazzar counted 8 false years in his 70-year count since he should have started from Yehoyachin’s capture. We see that the year of Yehoyachin’s capture (in the 8th year) is not counted in the 70 years. Achashverosh calculated the eight missing years to his second year and made a party in his third year (year 71).
Megilah continues that 19 years were actually false, since we count from the destruction. We see that the year of the destruction (in the 19th year) is also not counted in the 70 years. Megilah then adds 11 more years (for 70 years) for the missing 19 years starting from the third year of Achashverosh and ending in his 13th year. Megilah continues that the Beit Hamikdash should have been built (in the 71st year) in his 14th year. Non-Jewish king years start in Tishrei (R”H 2a). The destruction was in 3338. The 70 years (after the year of destruction) are from Tishrei 3339 to Elul 3408. The Beit Hamikdash is built in the 71st year in 3409.
Megilah then places the Beit Hamikdash in the second year of Daryavesh by removing some years of the previous count. Seder Olam and Rashi remove two years. Two years are needed to have the Beit Hamikdash built in the second year of Daryavesh as stated in Chagai and Ezra. It matches what was thought to be the 14th year of Achashverosh (from Tishrei to Tishrei). This is year 3409.
Megilah 11b is clear the redemption would come no later than either the end of the 70 years or the beginning of the 71st year. Since it places the building of the second Beit Hamikdash in the 71st year, we see that the redemption starts at the very beginning of the 71st year. The building of the Beit Hamikdash must therefore commence exactly at the beginning of the 71st year or in a way that can be considered as if such. What in fact happened is that the building of the second Beit Hamikdash started in Kisleiv 24, but some preparations were already done in the previous Elul 24 (Chagai 1:15 and 2:18). This overlap allows the preparations to count in the year it was built.
Both the preparations of Elul 24 and the building of Kislev 24 are stated in Chagai to be in the second year of Daryavesh. Rosh Hashana 3b explains that Tishrei did not start a new year because he was then treated like a Jewish king counting his years from Nissan to Nissan. R”H further shows from Ezra that his 6th and 7th years were treated like a non-Jewish king (because he soured). The building of Kisliev was in 3409 in the second year of Daryavesh. The preparations were in Elul 3408, which is Daryavesh’s first year from Tishrei to Tishrei, but his second year was predated to Nissan.
However, we can also say that the Beit Hamikdash is considered to start with the preparations of 3408 which recalculates to the first year of Drayavesh from Tishrei to Tishrei. This would be in the 13th year of Achashverosh. The building in the 14th year can mean a building in the 13th year and not counting that year, meaning that the building should take place in the year before the start of the count.
Erachin 13a explains the removal of 6 years of shemita from the 420 years of the second Beit Hamikdash. Ezra 4:24 has the building of the second Beit Hamikdash in the second year of Daryavesh. Ezra 6:15 states that he arrived in the land of Israel in the 7th year of Daryavesh (from Tishrei to Tishrei) in Av (3414). Rashi explains that Ezra therefore came in 6th year of the second Beit Hamikdash and he started shemita in the 7th year. If Ezra 4:24 includes the preparations of 3408 which recalculates to the first year of Daryavesh from Tishrei to Tishrei, Ezra still arrives in the 6th year of the Beit Hamikdash when the 420 years start from the year after it was built.
This approach explains tosafot in Erachin 12b. Tosfos there says that the second Beit Hamikdash was destroyed in the 421st year, but the first Beit Hamikdash was destroyed in the 410th year. But even if the first Beit Hamikdash began in 2928 and was destroyed in 3338 (like Rashi), the first Beit Hamikdash (2928-3338) was still destroyed in the 411th year in the same way that the second Beit Hamikdash (3409-3829) was destroyed in the 421st year. Tosafot must learn that that the first year of the first and second Beit Hamikdash does not count. The 420 years of the second Beit Hamikdash thus begin in 3409 after the year it started in 3408 (with the preparations). The second Beit Hamikdash (3409-3829) was destroyed in the 421st year not counting the year it began (3408), and the first Beit Hamikdash (2929-3338) was destroyed in the 410th year not counting the year it began (2928). This approach also has a full year for shemita for R’ Yehuda who counts all 420 years. But the simple approach also has a full year of shemitah for R’ Yehuda because the preparations count in the year it was built.
Rashi in Megilah gives a different explanation for adding 8 years instead of 7 for the 45 years of Nebuchadnezzar and for Belshatzar counting 8 false years instead of 7. Rashi says that Yehoyachin’s capture was not in the 8th year, but after 8 years. Similarly, the destruction 11 years later was not in the 19th year, but after 19 years. This explanation includes the year of the destruction (after the 19 years) in the 70 years. Nebuchadnezzar’s reign now began in 3019 (instead of 3020) because the destruction was (after 19 years) in his 20th year in 3338. This approach moves everything up one year. The building of the Beit Hamikdash is now in Kisleiv 3408, and the preparations were now in Elul 3407. The 420 years now start in 3408, and the destruction in the 421st year is in 3828. Rashi in A”Z has the 420th year as 3828. Rashi’s has two approaches, and both have 3828 as the first year of shemita. The halacha follows neither of Rashi’s approaches. Rather, 3829 is the first year of shemita.