An Unlawful Detainer lasts on your credit report for 7 years in CA. CA Civil Code Section 1785.13(a)(7). Leginfo.ca.gov is a good site if you need reference to the code.
it depends on the state, but most misdemeanors can be expunged from your record three years after the sentence is carried out. you will have to go back to court to have this done.