Back at the time the show was being made, nobody knew and nobody cared. The dates were finally fixed by the end of the first season of ST: The Next Generation, though, when it was made clear this season ended in 2364 and TOS was one century in the season's past. (Okay, the "one century in the past" bit was carved in stone with the somewhat later episode "Sarek" only, but still.) So, 23rd century.
Perhaps we should refresh our memories.
RALPH: What year is this?
DATA: By your calendar two thousand three hundred sixty four.
Note that Data tells Ralph Offenhouse that the year is 2364 by Ralph's calendar. Data implies that it is NOT Data's calendar. Note that Data doesn't seem to break the fourth wall and address the audience directly.
There is no direct evidence which of many possible calendars is used when Data tells Ralph the year is 2364.
But in "Encounter at Farpoint":
RIKER: Then your rank of Lieutenant Commander is honorary?
DATA: No, sir. Starfleet class of '78. Honours in probability mechanics and exobiology.
So according to Data's calendar Data graduated and was commissioned sometime between '78.00 and '78.99.
In "Datalore":
LAFORGE: This once was rich farmland. I'd say something like twenty to thirty years ago.
DATA: I was discovered twenty six years ago.
and:
LORE: Promises he later proved to be true. Which made you and me possible, brother. Our beloved father. Will I soon have a uniform like that, brother?
DATA: If you get one the way I did, Lore, it will mean four years at the Academy, another three as ensign, ten or twelve on varied space duty in the lieutenant grades.
If Data was commissioned a 2nd lieutenant three (3.00 to 3.99) after graduation which was sometime between '78.00 and '78.99, that would be sometime between '81.00 and 82.98. If Data became a lieutenant commander 10.00 to 12.99 years later it would be sometime between '91.00 and '95.97, and that would be the earliest possible date range for "Datalore".
If Data spent four years (4.00 to 4.99) at the Academy before graduating between '78.00 and '78.99 he would have entered the Academy between '73.01 and '74.99. If Data entered the Academy immediately after being discovered and activated, "Datalore" 26 years (26.00 to 26.99) later would be sometime between '99.01 and '01.98 of the next century.
So if Data graduated in 2278 "Datalore" would happen in 2291.00 to 2295.97, or in 2299.01 to 2301.98.
If Data graduated in 2378 "Datalore" would happen in 2391.00 to 2395.97, or in 2399.01 to 2401.98.
And those date ranges are totally inconsistent with "The Neutral Zone" happening in 2364. Therefore, Data probably used the current official United Earth calendar in the first season of TNG, and in "The Neutral Zone" told Ralph Offenhouse the date in the calendar that had been used in Ralph's era. Then after the revived dead people returned to Earth they became celebrities, and groups which wanted to make Ralph's calendar the official United Earth calendar used their popularity to get the calendar change passed by the United Earth government. And then dates given in later TNG era shows and movies were dates in the new official United Earth calendar.
So after seeing one official Earth calendar replaced by another one in TNG I soon noticed the use of such inconsistent dates in TOS that several different Earth calendars had to be used by different people.
I think there are only about a half dozen dates in
Star Trek that are directly said to be dates AD or BC. All of the rest are in unspecified calendars and thus do not have to be dates AD or BC.
The Great Makers had decided on TOS having happened in the 2260s a bit earlier already, and had inserted the words "in the 23rd century" to the opening of the second TOS movie, Wrath of Khan. But that still theoretically allowed for TOS to have happened in the late 22nd for those who wanted to argue. Nowadays, it's pretty clear-cut, and multiple episodes have made direct reference to TOS having happened exactly X years before known year Y, the end result being the 2260s.
The "In the 23rd century" (and thus sometime between 2201 and 2300 in the calendar used) title in
Star Trek II: The Wrath of Khan may refer to either the date that Saavik took the the
Kobayashi Maru test or to the hypothetical future date when Saavik would become a starship captain, the future date that her
Kobayashi Maru test was set in. Thus "Space Seed" should have been about 15 years earlier than sometime between 2201 and 2300, and thus sometime between about 2186 to 2285, or else possibly 15 years before the date of
Star Trek II: The Wrath of Khan that is itself decades before Saavik becomes a captain sometime between 2201 and 2300. If Saavik is expected to be a starship captain 20 years in the future,
Star Trek II: The Wrath of Khan could be sometime between 2181 and 2280, and thus "Space Seed" could happen sometime between 2166 and 2265.
Lines suggesting some other dating must now be treated as mistakes. Although they can all be treated as mistakes made by the characters in-universe (expendable extra Jaeger sees Trelane's castle is from 900 years ago, even though the interior decoration is actually more recent, in "Squire of Gothos"), or jokes (such as Kirk accepting another character's approximate dating in "Tomorrow is Yesterday" rather than nitpicking), or scifi moments (Khan slept for 200 subjective years on an interstellar voyage that took closer to 300 years, thanks to relativistic time dilation). Yadda yadda.
Timo Saloniemi
You remember "The squire of Gothos" incorrectly.
KIRK: Sunlight, palm trees. We're nine hundred light years from that kind of desert, Bones.
And:
TRELANE: I can't tell you how delighted I am to have visitors from the very planet that I've made my hobby. Yes, but according to my observations, I didn't think you capable of such voyages.
JAEGER: Notice the period, Captain. Nine hundred light years from Earth. It's what might be seen through a viewing scope if it were powerful enough.
TRELANE: Ah, yes. I've been looking in on the doings on your lively little Earth.
KIRK: Then you've been looking in on the doings nine hundred years past.
TRELANE: Oh, really? Have I made an error in time? How fallible of me. Oh, I did so want to make you feel at home. I'm quite proud of the detail.
Jaeger believed that because Trelane's knowledge of Earth seemed centuries out of date, and since they were 900 light years from Earth, Trelane must have been viewing Earth using some sort of viewing scope like device using radiation that traveled at the speed of light. Jaeger obviously didn't stop to try to figure out which century of Earth history Trelane's decorations resembled or to count how many centuries in the past that was.
No doubt Jaeger and Kirk later realized that Trelane must have had some other method of learning about Earth. Trelane couldn't have seen events that happened at night on Earth, nor events which happened on the far side of Earth though the planet, nor events which happened indoors, and Trelane would have a very bad viewing angle for many events which he could see. And Trelane knows words and names in Earth languages and can speak sentences in Earth languages.
So Jeager and Kirk's error was more an error in imagining the method Trelane might have used instead of an error in historical chronology - they assumed Trelane was studying Earth 900 years in their past because it would take electromagnetic radiation 900 years to reach Gothos, not because they believed Trelane's Earth items were 900 years out of date.
...or scifi moments (Khan slept for 200 subjective years on an interstellar voyage that took closer to 300 years, thanks to relativistic time dilation). Yadda yadda.
Timo Saloniemi
If the voyage took 251 years and Khan slept in suspended animation for 200 years, the time dilation would have made 200 years pass on the
Botany Bay while 251 years passed on Earth, and time would be passing 0.78 as fast on the
Botany Bay as on Earth. I think that the
Botany Bay would have to travel over 0.50 times the speed of light to have that much time dilation.
MARLA: Captain, it's a sleeper ship.
KIRK: Suspended animation.
MARLA: I've seen old photographs of this. Necessary because of the time involved in space travel until about the year 2018. It took years just to travel from one planet to another.
So if it took years just to travel from one planet to another in Earth's solar system, and if DY-100 class ships like the
Botany Bay could reach over 0.50 the speed of light, those really long interplanetary voyages within our solar system must have been to planets at least half a light year from the planets known to us.
That seems rather improbable.