You can download this handy chart that shows milage and driving times from many places in California to Yosemite Valley. It is a 140kb PDF file.
Yosemite Driving Times PDF
From the west and north
San Francisco/Bay area
Distance: 195 mi / 314 km
Time:4-5 hours
Take I-580 east to I-205 east to Highway 120 east (Manteca) or Highway 140 east (Merced) into Yosemite National Park.
Sacramento
Distance: 176 mi / 283 km
Time: 4 hours
Take Highway 99 south to Highway 120 east (Manteca) or Highway 140 east (Merced) into Yosemite National Park.
Reno & Lake Tahoe
Approximately June through October, conditions permitting
Distance: 218 mi / 351 km (Reno)
Time: 5 hours
Take US 395 south to Lee Vining; take Highway 120 west into Yosemite National Park (open late May/June through October, depending on conditions).
All year
Distance: 315 mi / 507 km (Reno)
Time: 8 hours
Take I-80 or I-50 west to Sacramento; take Highway 99 south to Highway 120 east (Manteca) or Highway 140 east (Merced) into Yosemite National Park.
From the south
Los Angeles area
Distance: 313 mi / 504 km
Time: 6 hours
Take I-5 north (or I-405 north to I-5) to Highway 99 north to Highway 41 north (Fresno) into Yosemite National Park.
San Diego area
Distance: 441 mi / 710 km
Time: 8 hours
Take I-5 north to Highway 99 to Highway 41 north (Fresno) into Yosemite National Park.
Las Vegas
June through October, conditions permitting
Distance: 350 mi / 560 km
Time: 6-7 hours
Take I-15 west to Barstow; Highway 58 west to the junction with US 395; go north on US 395 to near Lee Vining; take Highway 120 west into Yosemite National Park (open late May/early June through October, depending on conditions).
November through May
Distance: 495 mi / 797 km
Time: 8-10 hours
Take I-15 west to Barstow; Highway 58 west to Bakersfield; take Highway 99 north to Fresno. In Fresno, take Highway 41 north into Yosemite National Park.
Death Valley National Park
June through October
Distance: 270 mi / 435 km
Time: 5 hours Take Highway 190 west to US 395. Take US 395 north to Lee Vining; take Highway 120 east into Yosemite National Park (open late May/early June through October, depending on conditions).
November through May
Distance: 450 mi / 720 km
Time: 9 hours
Take Highway 190 west to US 395; take US 395 south to its junction with Highway 14. Take Highway 14 south to Mojave. In Mojave, take Highway 58 to Bakersfield. From Bakersfield, head north on Highway 99 to Fresno. In Fresno, take Highway 41 north into Yosemite National Park.