Probably longer than you think. At least months, possibly years. One popular rule of thumb is that the time required for marriage recovery is often equal to the length of affair (from start to absolute end). That is not a scientific measure, but I believe it is helpful for a couple (especially the offending spouse) to be prepared to invest as much time for healing as was invested in the betrayal.
Unfortunately, many couples try to short-cut the recovery process. Once the affair is confessed and some sort of apology is made, these couples attempt to move ahead with "life as usual" even though the confession is only the beginning of healing and restoration. Both you and your spouse will need to be committed to the process. (In most cases, the offending spouse is ready to move forward before the betrayed spouse has the ability to do so.)
The road to recovery is difficult. You'll have to be willing to go through a lot of pain to get to the other side. Your partner will have to exercise a lot of patience and care to help you get there. You'll have good days, bad days, and really bad days, but as time goes by you'll discover that the bad days diminish and the good days increase.