When entering data into your database use time() to get the value you put in the database, that's the standard unix time. ie the number of seconds since unix epoch (January 1 1970 00:00:00 GMT)
Then when you're retrieving the data from your database use date() to convert that timestamp to human readible text. It's documented
here.
To get the format you described you'd use:
date('Y-m-d H:i', timestamp);