Format date fields in ISO 8601 format

Modify the queryToArray function to format the date fields in ISO 8601 format yyyy-mm-ddTHH:mm:ss.lZ