There are certain rules to follow when we convert direct speech into reported speech. For example:
"How long can I stay?" asked Peter.
Peter asked how long he could stay.
The inverted commas and the question mark are left out in reported speech. The verb changes from the present tense (can) to the past tense (could) and comes later in the sentence.
However, some changes depend on the time that the speech is reported. For example:
"I will come home tomorrow," said Jim.
If we are reporting this on the same day, we can write:
Jim said he would come home tomorrow.
If Jim spoke on a Tuesday but we don't report it until a few days later we would have to write:
Jim said he would come home on Wednesday.
Some changes also depend on the place where the speech is reported. For example:
"How long have you lived here?" asked Miss Carter.
If we are still in the same place when we report this, we can write:
Miss Carter asked how long we had lived here.
If we are no longer in the same place we would have to change the word here to there.
Miss Carter asked how long we had lived there.