Ashkelon is 20 miles away from Timnah. Since the companions
had come to him at sundown on the seventh day, that suggests he would not have arrived at Ashkelon any earlier than 3:00 the next morning. The city gates would have been closed and the city asleep. He could only have entered the city and accomplished his killing spree during daylight hours, when the gates were open and the people were out on their business. So it is not unreasonable to think that the earliest possible time for him to have acted was the morning after the companions solved the riddle. This would have given him some time to calm down and think things over.1 That said, the text does not relay this information, and so we are left with the impression from the text itself that his actions were motivated by revenge.
19 And the Spirit of the LORD rushed upon him, and he went down to Ashkelon and struck down thirty men of the town and took their spoil and gave the garments to those who had told the riddle. In hot anger he went back to his father’s house.