Cut it open and count the rings? Oh, riiiiight, fish are not trees.
Well, if you are exceptionally experienced, a fish's age is directly correlated with its size. Fish do grow continuously their entire lives. Obviously, the growth rate over time is not constant, rapid growth when young and diminishing to almost zero when older. So, if you have a keen eye and know what size a fish is when it is a certian age, a guess could be made. That said, it really is only a guess because one can only know the average size of a fish compared to its age. Just like people, some fish are big, some are small, some are tall, some are short, etc. And, unless there is some other obvious determining factor (like a color change at maturity), there is no wya to know if you got an older shorter fish, or an average fish, or a young tall fish.
rdd is right in that the tank-bred fish are usually pretty young, the less time the breeder has to keep them, the less money it costs to keep them, so those fish are sent out as young as possible. But, wild caught fish could be anywhere from juvenille to exceptionally elderly. If you really want to know, this is where research comes in to play. You would need to research whether a fish is tank-bred or wild-caught or possible both. Then, research what their lifespan is like and be able to make a guess from there.