For how long should you prepare?

Short answer: Two weeks.
Long answer: There is no single "right" answer to that question.

To make intelligent preparations for the aftermath of an earthquake, you have to have some idea of how long you might have to depend on your own resources. Official recommendations used to most commonly focus on 3 days, but have recently been moving upward to 2 weeks; the simple truth is that nobody really knows ahead of time how long a given crisis will last. Any estimate is a guess, but some guesses are more educated than others. Another factor is that the "official" guidelines may sometimes have taken into account perceptions of what people are actually willing to do, e.g. an author who believed that 1 week is a prudent estimate might have reduced that number to 3 days out of fear that a recommendation that looks too hard might discourage people from doing anything at all.

My family stores enough food and water for 30 days, but that's largely a function of how much we have room for. I don't seriously expect to be entirely without any help at all for a whole month, but we store extra supplies so we can eat and drink more than the bare minimum, and so that we can provide a bit of help to our neighbors if they run out.

So, just as in an actual emergency, you're on your own here. Consider the magnitude of damage that might occur in a major quake, the resources that would — and would not — be available (for example, San Jose has about 1 fire station per 28,000 residents), and the time it would take to mobilize those resources. Looking at recent history, the only natural disaster in the USA that was remotely comparable in magnitude would be Katrina, and you no doubt remember how long it took to get help to those unfortunate souls. (Experience with Katrina is part of the reason that the American Red Cross now recommends 3 days for a car-kit but 2 weeks for home supplies.) You might also want to consider the 2008 earthquake in Sichuan, China; while perhaps not directly comparable, the Chinese did have considerable resources and the social and political will to deploy them, yet because so much infrastructure had been damaged it still took many days for help to reach the victims.

Let's say you decide you want to be ready for 2 weeks, but that just seems overwhelming. Don't panic or give up, just take it a piece at a time. Prepare now for 3 days, and in a few weeks or whenever you are able prepare for another few days, and then later for another few. You can also set priorities, such as storing food for 3 days but water for a week. Remember that something is better than nothing, and that even slow progress will let you reach your goal if the progress is steady.