Prevent error message when there is a datetime object in the query result