God made his covenant with David after he had given him "rest from all his enemies around him" (2 Samuel 7:1). God began the covenant by rehearsing the things he had already done for David and then told David what he would do for him in the future. Most of the verbs in 2 Samuel 7:4-17 are in the perfect tense. In Hebrew, the perfect tense is used for past events and for events in the prophetic future. Therefore, on the basis of the verbs alone, it is impossible to tell when God made the shift from past to future.
Many translations assume that because the wars with Philistia, Moab, Ammon, Aram, and Edom and are not related until chapters eight and ten, the shift to future tense in English should begin somewhere before verse eleven (verse nine in the NIV). However, to make the shift in verse nine creates a contradiction with verse one where the Hebrew perfect must be translated as a past tense. Furthermore, making the change in verse nine ignores the time marker that signals the shift to the future in verse twelve: "When your days are over and you rest with your fathers, I will raise up your offspring to succeed you." (The NIV adds the word "now" in verse nine to mark the shift to future tense, but the word does not appear in the Hebrew text.) Therefore, the verbs in verses eight through eleven should be translated in the past tense in English, and the verbs beginning in verse twelve should be translated in the future tense as in Young's Literal Translation. This suggests that the covenant was made after the wars recounted in chapters eight and ten. At that point, the land of Ammon had been laid waste though the capital city of Rabbah had not yet fallen. The author, however, placed David's desire to build a house for God and God's covenant in chapter seven to connect it thematically with the ark being brought to Jerusalem in chapter six.
Although the covenant must be placed after the wars of chapters eight and ten, it must be placed before the birth of Solomon because God said that he would raise up offspring "who will come from your own body" (2 Samuel 7:12), wording which alludes to God's covenant with Abraham. Furthermore, it must be placed before the siege and fall of Rabbah (2 Samuel 12). If God had made the covenant after David's sin, he would have appeared to be rewarding wickedness.