No two political groupings among the ancients counted the years in the same way. Usually it was by strictly local methods--a given years was "the year when so-and-so ruled the city," or "the seventh year of King so-and-so." Not only was it difficult to match the chronologies of one political unit with another, but even within a given political unit things were hazy if you forgot the order of the rulers or how long each had ruled.
Eratosthenes (see above) was the first person to try to make sense out of chronology and to match one system with another. He did his best to stretch dating back to the time of the Trojan War.
Meanwhile, Alexander the Great's general Seleucus I (ca. 358-281 B.C.) had marched into Babylon in 312 B.C. and counted that as year 1 of the Seleucid Era. The years were counted upwards indefinitely after that without regard to the succession of monarchs.
The actual year in which events took place in ancient times is still a bit hazy, and the farther back one goes the hazier it gets. However, thanks to the establishment of the Seleucid Era and to the work of Eratosthenes, there is less problem with dates than one might expect, especially for those after 312 B.C.