The battle of the Trench took place in the fifth year Hijri. The siege of Madinah started in Shawwal and ended in Dhul Qa‘dah, i.e. it lasted for over a month. It was in fact a battle of nerves rather than of losses. No bitter fighting was recorded; nevertheless, it was one of the most decisive battles in the early history of Islam and proved beyond a shadow of doubt that no forces, however huge, could ever exterminate the nascent Islamic power growing steadily in Madinah. When Allâh obliged the Confederates to evacuate, His Messenger was in a position to confidently declare that thenceforth he would take the initiative in war and would not wait for the land of Islam to be invaded. [Sahih Al-Bukhari 2/590]
Al-Ahzab (the Confederates) Invasion — page 200
The Sealed Nectar · Safiur Rahman al-Mubarakpuri · Translation: Issam Diab · Dar-us-Salam. PDF page 200. Source edition