When did Peru obtain its independence and from which country?

Peru gained independence from Spain on July 28th 1821.