James's age is not revealed in the epilogue of Deathly Hallows, but J.K. Rowling stated in an interview that his mother, Ginny Weasley, spent a "few years" playing for the Holyhead Harpies, and then "retired to have her family". As Ginny graduated from Hogwarts in 1999, and a "few years" implies at least three years, the earliest she could have retired to have James is 2002. He is at least a year older than his younger brother Albus, who was born between late 2005 and mid-2006. So he was presumably born between 2002 and 2005.
Ginny told Albus that they had written James three times each week the year before. It suggests that it had been James' first year at Hogwarts as James is rather an independent sort.