The ark of Yahweh was in the country of the Philistines seven months.
As frequently occurs in Biblical narratives, we have here a summary paragraph, followed by the elaboration of the details.  This gives a broad outline of what needed to be done, namely, that the ark should not be sent back without a guilt offering and also a promise (later explained as a `perhaps') that they would know if God had afflicted them, or if it was `by chance.'