See Chronology of the Harry Potter stories for more information on the timeline.  In a nutshell, it is based on a comment by Nearly Headless Nick in Chamber of Secrets when he invites Harry to his 500th death day party - and mentions he died Oct 31, 1492.  So, if it is his 500th death day, Chamber of Secrets takes place in Harry's 2nd year at Hogwarts, when he was 12 (since he had to be 11 to enter Hogwarts, as mentioned in Philosopher's Stone). Therefore, Harry's birth year was 1980.  Since Luna and Ginny are both a year behind, their birth years are 1981.  Voila )