First off, I'd say never go to an online writers thread for legal advice.
Secondly, it would vary from country to country.
Third, in the USA you can write whatever you want, the publisher would have legal liability not the writer. I believe written child porn is treated quite differently from photos, pictures, art, and such. Freedom of speech means you can write it,not that you can get it published. Actual age for criminal liability varies from state to state between 18 and 13. I've never heard of prosecution for a fictional character although a comic book publisher was once pursued unsuccessfully for a work depicting an infant. This site has its own limit which I believe is 13 years of age they are outlined in the guidelines for conduct.
Free advice which is worth every penny you pay for it. If you are writing, unless there is a compelling reason and age is an intricate part of the plot why even mention a specific age? If you are into youth describe that without putting a birth date down on paper.
Myself I'm an old fart and teens were never a big turn on for me but if you can't describe a teenager without showing us their birth certificate ... whatever.
preteens and kiddys are off limits here and on almost any other public forum in the USA, as they should be IMHO.
Hope that helps
Mad Lews