format fields to database format