This information is in further support of an answer close to Joshua Wilson's (which was not really much other information that the original link you posted), though leaning toward the older end of his range and perhaps even slightly older (15-18 years old).
Reading commentaries and looking at various translations informs one that Saul's age and length of reign are somewhat suspect from the witness in 1 Sam 13:1 (cf. Act 13:21). Such might have helped pinpoint David's age, but there is still some other evidences.
Some other Facts
David was 30 years old when he became king, having just moved from Ziklag (2 Sam 1:1), and settled in Hebron (2 Sam 2:4). It was not until Hebron that he had any children himself (2 Sam 3:2; 1 Chr 3:1), but he had already been married to both Ahinoam and Abigail (1 Sam 27:3) during the 1 year and 4 months he lived among the Philistines (1 Sam 27:7) immediately prior to Saul's death (1 Sam ch. 28-29).
David was then about 28 (30 - 1yr 4m) years old when he moved to Philistine land, the last part of his time in running from Saul.
Abigail did not become David's wife (1 Sam 25:42) until after Samuel died (1 Sam 25:1), so in the timeline of 1 Samuel, probably David was likely 26-27 when marrying Abigail.
Now Ishbosheth was 40 when his father Saul died (2 Sam 2:10), but Jonathan had been the oldest son (1 Sam 14:49, 20:31). So Ishbosheth was 10 years older than David, which means Jonathan was more than 10 years older than David.
Some Logical Conclusions
All the above is stated for the following reason—right after David's victory over Goliath, we have three things indicating something about his maturity that would point toward the higher end range of 15-18.
- David was large enough to be able to wear the robe and tunic of Jonathan (1 Sam 18:4), a man 10+ years David's senior. This indicates not a lot of height/size difference (like one would expect between say a 12 year old and a 23+ year old man).
- David was mature enough to be put in a command position immediately (1 Sam 18:5), and upon returning from defeating Goliath (vv.6-9), the next day (v.10) or soon after he was placed in command of 1000 men (vv.12-13). That is not a responsibility likely to fall upon someone too young (i.e. he became a man of war, based off defeating Goliath, despite his youth).
- David may have been old enough to be of marriageable age (1 Sam 18:26), though there is an undetermined time gap with 1 Sam 18:19. Still, given #1-2, #3 is likely true, David was old enough to be given a wife based off his slaying of Goliath.
The Inconclusiveness of David's Birth Order to Determine Age
There are problems with placing too much weight on David's birth order for determining his age. This is because:
- We do not know if any of his older brothers were twins or triplets.
We do not know his brother's ages, so assuming 4 older brothers not yet 20 (not men of war), then looking for a maximum age for David, assuming #1 is not true, and assuming a roughly normal gestation period (no premature births, about 40 weeks, or 9.23 months, we'll say 10 months minimum between pregnancies), we have this rough possibility:
4th oldest = 19yr 11m old
5th oldest = 19yr 1m old
6th oldest = 18yr 3m old
7th oldest = 17yr 5m old
David = 16yr 7m old
Yet if #1 is true, then for every multiple birth among these four brothers, David's maximum age would bump up one slot.
However, there is a reasonable possibility that David is the 7th of 8 total sons of Jesse. This would bump David up one slot in the above order as well. How could David be 7th of 8? Doesn't it state he is the "youngest" (1 Sam 16:11, 17:14), and clearly had seven brothers (1 Sam 16:10), with eight sons total (1 Sam 17:12)? Follow this logic...
First, 1 Chr 2:13-15 gives a listing of David's family by birth order from Jesse:
3rd Shimea (a.k.a Shammah, 1 Sam 16:9, 17:13)
8th is then unnamed and uncounted here
Some common ways of reconciling this with David being the youngest of eight speculates that this much later Chronicle account does not mention one brother who died young (i.e. before reaching manhood and/or having children; e.g. Jamieson-Fausset-Brown Bible Commentary on 1 Chr 2:15) or was disowned by Jesse between the Samuel and Chronicle accounts, or had a different mother (a solution noted in Gill's Exposition of 1 Chr 2:13), and is not listed here for one of these reasons.
Second, Gill's Exposition of 1 Chr 2:13 also notes others have David 7 of 8. He states (emphasis added):
Kimchi mentions a Midrash ... according to which
his name [David's unmentioned brother of 1 Chr 2] was Elihu, and was younger than David, who is mentioned in 1
Chronicles 27:18, and Jarchi observes, that the writer, having found
the pearl (David), reckons not the eighth son Elihu
Others consider Elihu of 1 Chr 27:18 to be another name for Eliab. Whether Elihu is the name of the 8th brother or not is irrelevant (though I lean that way), what is more important is dealing with the "youngest" terminology used for David, so...
Third, David may not have been the "youngest," but rather the "smallest" of his brothers. The word used, קָטָן (qāṭān) can mean "small" or even "unimportant" (see BDB). Given God's comment about Eliab's physical stature (1 Sam 16:7), the term being used of David may refer to his stature, not his age (which is even more plausible given the 1 Chr 2:13-15 information).
All this to say that not knowing details of the other brothers, David's age is rather flexible. If two brothers are twins and David was 7th in order, then David could well be 18 years old.
The word used of David's "youth" (1 Sam 17:33, 42) is נַ֫עַר (nǎʿǎr). There is a large range of flexibility in its meaning (see BDB), including "marriageable age," and David using the term himself of Absalom (2 Sam 18:5), his third son (2 Sam 3:3) at a time when he was clearly already a grown man (having his own children, 2 Sam 14:27). So it can be a very "relative" term, as well as one indicating appearances of youth. So the term could still easily be used of one just under 20 years old.
Final Concluding Thoughts
Based off the time frame of David marrying Abigail, there has to be some years time for his fleeing Saul prior to that, as well as his brief marriage to Michal that occurred relatively soon after the Goliath incident. That, coupled with the information from Joshua Wilson's answer certainly weighs to him being under 20 at the time of the encounter.
However, the other factors of his size and maturity hinted at in connection with his slaying of the giant weight heavily to his being probably not less than 15, and likely a couple more years mature than that.