I drive a manual (stick shift) and I started driving again at about 4 weeks. You need to be able to move both left and right feet easily and fast enough to use the pedals. Before I started driving again, I used to sit in the car with the engine turned off and practice moving my feet fast from one pedal to another.
You might be able to drive an automatic earlier than 4 weeks and I have read of people doing just that. It does depend, though, on which knee you are having done. Obviously, with a left knee replacement you might be able to drive earlier than with a right knee replacement.
Whichever type of car you drive, you need to be off the strong narcotics - don't want to be driving "under the influence" - and you need to be absolutely certain that you can perform an emergency stop.
I have heard that some insurance companies require a clearance from your surgeon, so it might be a good idea to check that.