David receives the town of Ziklag from King Achish (1 Sam 27:5-27:7)

“Then David said to Achish. ‘If I have found favor in your sight, let a place be given me in one of the country towns, so that I may live there. Why should your servant live in the royal city with you?’ So that day Achish gave him Ziklag. Therefore Ziklag has belonged to the kings of Judah to this day. The length of the time that David lived in the country of the Philistines was one year and four months.”

David asked for a town outside of Gath for his men. Each major town must have had surrounding suburban towns. He ended up at Ziklag, which was a city of Judah when the writing of this work took place.  They stayed there about 1 year and 4 months.