It depends on three things -- being off all opiod pain medications, your doctor's approval, and when you feel you can safely operate a vehicle.
My doctor cleared me at three weeks for my right knee. I live in a small town. But I sat in the vehicle and practiced moving from the accelerator to the brake with the vehicle turned off first. When I felt comfortable with that, I drove my truck across the street to the empty high school parking lot and drove around the parking lot, practicing using my leg in imagined driving situations -- normal stops, then a couple panic stops. I felt mostly okay, but I chose to drive in my small town for about the first week and let my husband drive longer distances.
If your doctor says you can drive but YOU don't feel you're safe to drive yet, then be responsible and don't do it.