Add a function to the database class to get a date and time formatted for insertion into the database.
This way if the database backend ever changes we only have to change the date format in one spot.
Merge branch 'master' into auth