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. This the closest thing I've found to a standard date format for json.