I don't work out at the gym, but I work out with a trainer doing bodyweight exercises, heavy weights, and all that fun stuff. It was 2 months for me - when I was first cleared for exercise I still couldn't lift more than 10 lbs, so I wasn't very motivated to do it until I was a little further out. I also wasn't supposed to do a lot of exercise (beyond walking) until I was eating at least 800-1000 calories/day consistently. And that took me a while. Honestly, between eating so little and just the natural time it takes to recover from what is a major surgery, 2 months was right for me.
When I started back with the trainer, I went slow on weights and ab work until I was confident with my body being ready for it.