In the sixth book, Hermione, being sharp as her little mind is, quickly gets Harry and Dumbledore to concoct a potion which would take the entire school year to brew. This potion would change everything that would happen, resulting them being set back to the year 1979, before Harry was born to stop Ron and Hermione cheating on each other so that everything that is written in the books come true.

Finally, they finish it and then in the seventh book it describes them pouring the potion everywhere.

And then, the world changes with a big BOOM but they added too much half blood prince blood

So the entire world was set back to where it began...