Time Freak

Stillman, a heartbroken physics student, builds a time machine when his girlfriend breaks up with him. Going back in time, he attempts to save their relationship by fixing every mistake he made—while dragging his best friend along in the process.
If at first you don't succeed, build a time machine.