The length of time that David lived in the country of the Philistines was one year and four months.
Now David and his men went up and made raids on the Geshurites, the Girzites, and the Amalekites; for these were the landed settlements from Telam on the way to Shur and on to the land of Egypt.
References for 1 Samuel 27:8
David struck the land, leaving neither man nor woman alive, but took away the sheep, the oxen, the donkeys, the camels, and the clothing, and came back to Achish.
When Achish asked, "Against whom have you made a raid today?" David would say, "Against the Negeb of Judah," or "Against the Negeb of the Jerahmeelites," or, "Against the Negeb of the Kenites."
References for 1 Samuel 27:10
David left neither man nor woman alive to be brought back to Gath, thinking, "They might tell about us, and say, "David has done so and so.' " Such was his practice all the time he lived in the country of the Philistines.
Achish trusted David, thinking, "He has made himself utterly abhorrent to his people Israel; therefore he shall always be my servant."