You can usually drive 6 weeks after joint replacement surgery. Your knee and hip should bend sufficiently so that you can enter and sit comfortably in your car and your muscle strength and control can coordinate braking and acceleration. I will discuss the details specific to your situation.
Always check with your car insurance company before getting back on the road. It is important that in an emergency you can stop the car safely.