Write date into database.