Public transport (BART) is the most efficient way to get to SFO or OAK.
For SFO: take the San Francisco Int'l Airport BART train to the San Francisco Int'l Airport station from any downtown San Francisco BART station. Upon arrival, you will take a short monorail ride to your desired terminal. Total time is approximately 40-45 minutes.
For OAK: take the Dublin/Pleasanton BART train to the Oakland Coliseum/Oakland Int'l Airport station. Transfer to the short monorail/shuttle, which drops you off at the terminals. Total time is approximately 50-55 minutes.
By car or taxi, the drive to either SFO or OAK can take 30 mins - 1 hr depending on traffic conditions.