Drivers will be transferred to the £1.35 billion crossing from the Forth Road Bridge on Wednesday, 30 August, but then switched back on Saturday 2 and Sunday 3 September.
This is to enable 50,000 people to take part in a “once in a lifetime chance” to walk over the new bridge, which is otherwise closed to pedestrians.
There will be no similar special access for cyclists.
The opening date will also enable economy secretary Keith Brown to honour the revised estimate of mid-July to the end of August he announced in March.
Completion of the bridge has been twice delayed by bad weather, first from December to May.
The date of the separate official opening has still to be announced and the Scottish Government’s Transport Scotland agency was unable to say whether it would cause further disruption to drivers.
It said the walking days could have been staged before the opening, but risked two days’ of contingency time set aside for further weather delays.
The move was criticised by motoring group IAM RoadSmart. Policy director Neil Greig said: “The opening of the new Forth bridge is the best news drivers have had in ages.
“Closing it down straight away makes absolutely no sense and can only add to confusion for drivers.
“The bridge walk is a fantastic event but it would have been much better to get it all done before opening the bridge.”
Following the weekend closure, junction changes will be made to restrict traffic on the Forth Road Bridge to buses and taxis.
Walkers and cyclists will continue to use their segregated lanes on the bridge.
Scottish Conservatives transport spokesman Liam Kerr said: “Commuters will be relieved that there’s now an end in sight to this long-awaited and much-needed project.
“It’s now essential all the surrounding work is complete and that the unveiling can go without a hitch. “Taxpayers and road users won’t tolerate any further delays.”
Scottish Labour counterpart Neil Bibby said: “This bridge would make a huge difference to the travelling public and the number of delays that have hit this development reflect badly on the SNP’s ability to manage large-scale infrastructure projects.
“While this new opening date is right at the very end of a revised timescale given by Mr Brown in March, people will rightly question why he waited until after the election to confirm the delay.”