Why does the date and time on my iphone?

Every single time my battery dies, whenever i charge it and it comes back on the date and time are completely wrong. Today after i charged it the date showed December 31 1989. What is causing this problem and how can i fix it?

You fell in a sexy time warp, I hear it happens to all beautiful women

When your battery completely dies, the phone can no longer keep track of the date/time.
When you turn it back on it SHOULD get the correct time again, but you must of turned that feature off if the time stays wrong.

Go to Settings > General > Date & Time and make sure that 'Set Automatically' is turned ON.
If it continues to happen, go to Settings > Privacy > Location Services > System Services (scroll to the bottom to find it) and ensure 'Setting Time Zone' is set to ON.

if the problem persists, take it to an Apple Store and they will have a closer look at it.