How to get reliable yesterdays date?

It wouldn't be too bad as a "programming exercise." Not too trivial, but not really difficult, either.
Not an bad exercise is generating a test program, either...