Been there, done that.
From my personal experience, there was NOTHING short of opiate painkillers that would touch the pain and that wasn't a route I wanted to take. So, yes, I was as crabby as f***.
Had my hip surgery in February 2011. Was back in the saddle May 2011. Never looked back. I haven't had a knee replacement but my wife has. The best advice I can give you is to get as fit as you can PRE surgery. This will have you in the best shape for the Physioterrorist POST surgery. Good luck